1

I want to use module msnodesqlv8 to do Windows Authentification in my DB.

My code is pretty simple and looks like this:

const sql = require('mssql/msnodesqlv8');

const config = {
  server: 'ServerName',
  instanceName: 'InstanceName',
  driver: 'msnodesqlv8',
  options: {
    trustedConnection: true,
    trustServerCertificate: true
  },

};

sql.connect(config)
  .then(() => console.log('Connected with Windows Auth'))
  .catch(err => console.error(err));

When i do node server.js it shows me an error:

node:internal/modules/cjs/loader:1404
  throw err;
  ^

Error: Cannot find module 'msnodesqlv8'
Require stack:
- C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\mssql\lib\msnodesqlv8\connection-pool.js
- C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\mssql\lib\msnodesqlv8\index.js
- C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\mssql\msnodesqlv8.js
- C:\inetpub\wwwroot\mahlzeit_dev\backend\server.js
    at Function._resolveFilename (node:internal/modules/cjs/loader:1401:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1057:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1062:22)
    at Function._load (node:internal/modules/cjs/loader:1211:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1487:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\mssql\lib\msnodesqlv8\connection-pool.js:3:19)
    at Module._compile (node:internal/modules/cjs/loader:1730:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\mssql\\lib\\msnodesqlv8\\connection-pool.js',
    'C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\mssql\\lib\\msnodesqlv8\\index.js',
    'C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\mssql\\msnodesqlv8.js',
    'C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\server.js'
  ]
}

In the other answers I found that I need to install msnodesqlv8 to be able to use it with mssql module as a driver, but when I do npm install msnodesqlv8 --save I see error:

npm error code 1
npm error path C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\msnodesqlv8
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm error prebuild-install warn install unable to verify the first certificate
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error gyp ERR! find Python
npm error gyp ERR! find Python checking Python explicitly set from command line or npm configuration
npm error gyp ERR! find Python - "--python=" or "npm config get python" is "C:\Python27\python.exe"
npm error gyp ERR! find Python - executable path is ""
npm error gyp ERR! find Python - "" could not be run
npm error gyp ERR! find Python checking Python explicitly set from environment variable PYTHON
npm error gyp ERR! find Python - process.env.PYTHON is "C:\Python27\python.exe"
npm error gyp ERR! find Python - executable path is ""
npm error gyp ERR! find Python - "" could not be run
npm error gyp ERR! find Python checking if the py launcher can be used to find Python 3
npm error gyp ERR! find Python - executable path is ""
npm error gyp ERR! find Python - "" could not be run
npm error gyp ERR! find Python checking if "python3" can be used
npm error gyp ERR! find Python - executable path is ""
npm error gyp ERR! find Python - "" could not be run
npm error gyp ERR! find Python checking if "python" can be used
npm error gyp ERR! find Python - executable path is ""
npm error gyp ERR! find Python - "" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python311\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python311\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python311\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python311\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python311-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python311-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python311-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python311-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python311-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files (x86)\Python311-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python310\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python310\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python310\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python310\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python310-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python310-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python310-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python310-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python310-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files (x86)\Python310-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python39\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python39\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python39\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python39\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python39-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python39-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python39-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python39-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python39-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files (x86)\Python39-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python38\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python38\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python38\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python38\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python38-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python38-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files\Python38-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files\Python38-32\python.exe" could not be run
npm error gyp ERR! find Python checking if Python is C:\Program Files (x86)\Python38-32\python.exe
npm error gyp ERR! find Python - version is ""
npm error gyp ERR! find Python - version is  - should be >=3.6.0
npm error gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
npm error gyp ERR! find Python - "C:\Program Files (x86)\Python38-32\python.exe" could not be run
npm error gyp ERR! find Python
npm error gyp ERR! find Python **********************************************************
npm error gyp ERR! find Python You need to install the latest version of Python.
npm error gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm error gyp ERR! find Python you can try one of the following options:
npm error gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm error gyp ERR! find Python (accepted by both node-gyp and npm)
npm error gyp ERR! find Python - Set the environment variable PYTHON
npm error gyp ERR! find Python - Set the npm configuration variable python:
npm error gyp ERR! find Python npm config set python "C:\Path\To\python.exe"
npm error gyp ERR! find Python For more information consult the documentation at:
npm error gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm error gyp ERR! find Python **********************************************************
npm error gyp ERR! find Python
npm error gyp ERR! configure error
npm error gyp ERR! stack Error: Could not find any Python installation to use
npm error gyp ERR! stack at PythonFinder.fail (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\find-python.js:306:11)
npm error gyp ERR! stack at PythonFinder.findPython (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\find-python.js:164:17)
npm error gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm error gyp ERR! stack at async configure (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\configure.js:27:18)
npm error gyp ERR! stack at async run (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\bin\node-gyp.js:81:18)
npm error gyp ERR! System Windows_NT 10.0.20348
npm error gyp ERR! command "C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\node\\bin\\node.exe" "C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\msnodesqlv8
npm error gyp ERR! node -v v14.21.3
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok

As can be seen in the error message I have already downloaded Python v2.7 and set it as Environmental Variable and also I added it via npm config edit , but I still get the same error, because it says: npm error gyp ERR! find Python - executable path is ""

I have cleaned node cache too, to results.

I have also tried to manually download module from github, but it was giving "Module not found" error.

When I try to do it with just const sql = require('mssql'); and driver: 'msnodesqlv8', it gives me an error ConnectionError: Login failed for user ''. . So it thinks that I'm sending empty credentials, but it should be like that for Windows Authentification.

My current Node version is 22.15.0, but I have tried also with version 14.21.3, but still same error.

SQL Server configured for mixed authentification "SQL Server and Windows Authentification mode".

I have installed Python v3.6.0 and now I'm getting a different error message:

npm error code 1
npm error path C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\msnodesqlv8
npm error command failed
npm error command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm error prebuild-install warn install unable to verify the first certificate
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | win32 | x64
npm error gyp info find Python using Python version 3.6.0 found at "C:\Users\pxuKisTool-Prod-APP\AppData\Local\Programs\Python\Python36-32\python.exe"
npm error gyp ERR! configure error
npm error gyp ERR! stack TypeError: Cannot read property 'pipeline' of undefined
npm error gyp ERR! stack at Object.<anonymous> (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\install.js:8:32)
npm error gyp ERR! stack at Module._compile (internal/modules/cjs/loader.js:1114:14)
npm error gyp ERR! stack at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
npm error gyp ERR! stack at Module.load (internal/modules/cjs/loader.js:979:32)
npm error gyp ERR! stack at Function.Module._load (internal/modules/cjs/loader.js:819:12)
npm error gyp ERR! stack at Module.require (internal/modules/cjs/loader.js:1003:19)
npm error gyp ERR! stack at require (internal/modules/cjs/helpers.js:107:18)
npm error gyp ERR! stack at Object.acc.<computed> [as install] (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\node-gyp.js:80:32)
npm error gyp ERR! stack at getNodeDir (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\configure.js:79:26)
npm error gyp ERR! stack at configure (C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\node-gyp\lib\configure.js:28:10)
npm error gyp ERR! System Windows_NT 10.0.20348
npm error gyp ERR! command "C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\node\\bin\\node.exe" "C:\\inetpub\\wwwroot\\mahlzeit_dev\\backend\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm error gyp ERR! cwd C:\inetpub\wwwroot\mahlzeit_dev\backend\node_modules\msnodesqlv8
npm error gyp ERR! node -v v14.21.3
npm error gyp ERR! node-gyp -v v11.2.0
npm error gyp ERR! not ok

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.