Node js knex and mssql error - 'TypeError: _this.driver.Connection is not a constructor'

Don't ask questions, rather heads-up in case anyone else runs into this. When creating a new node project, I want to use knex to access the MSSQL database server. I am initializing knex with this:

{
client: 'mssql',
connection: {
    driver: 'msnodesqlv8',
    server: 'localhost',
    database:'testdb'
    options: {
        trustedConnection: true
    }
}

      

I get the error: "TypeError: _this.driver.Connection is not a constructor". After a lot of searching, I couldn't find anything with this error message, so it felt like I would put chapters here.

I have installed the latest knex, mssql and msnodesqlv8 packages. And this is the problem. Since mssql v4.x, knex and mssql don't play well (at the moment). I was able to fix this by downgrading the mssql package to 3.3.

+3


source to share


1 answer


The answer is exactly as indicated at the end of the question.

"I installed the latest knex, mssql and msnodesqlv8 packages. And this problem: with mssql v4.x, knex and mssql don't play well (at the moment). I was able to fix this by downgrading mssql to 3.3."



I was able to solve the problem with this solution too.

+1


source







All Articles