Connecting Nodejs with MS SQL Server through Knex npm package

This videos demonstrates how to connect Nodejs with MS SQL Server with Knex npm package. It explains how to pass on the configuration information while connecting to MS SQL Server and also run a select query to get data in Nodejs.


  1. Hello sir i created a db file where i tested it and it works but i'm try to call the db created on my main App.js file but this is actually the error i'm getting "Access denied for user ''@'localhost' (using password: NO)"

  2. node:internal/modules/cjs/loader:936

    throw err;


    Error: Cannot find module 'knex'

    Require stack:

    – C:UsersCocran MACdev3knexdemo.js

    ←[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)←[39m

    ←[90m at Function.Module._load (node:internal/modules/cjs/loader:778:27)←[39m

    ←[90m at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m

    ←[90m at require (node:internal/modules/cjs/helpers:102:18)←[39m

    at Object.<anonymous> (C:UsersCocran MACdev3knexdemo.js:1:12)

    ←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m

    ←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m

    ←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m

    ←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m

    ←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m {

    code: ←[32m'MODULE_NOT_FOUND'←[39m,

    requireStack: [ ←[32m'C:\Users\Cocran MAC\dev3\knexdemo.js'←[39m ]


    do you know what it means?

  3. Hiii! thank you so much for the tutorial…
    I got this error while ejecuting the code:
    "message": "Failed to connect to localhost:1433 – Could not connect (sequence)",
    "code": "ESOCKET"
    this is what I catch…If you could help me I will be so grateful. 😞

Leave a Reply

© 2023 53GB