npm install sqlite3 - gyp error: unable to get local issuer certificate

孤街醉人 提交于 2020-06-29 04:52:10

问题


I am working on clean Windows 10 installation. When trying to run npm install sqlite3 from myproject path, getting the following error:

gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to get local issuer certificate
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1474:34)
gyp ERR! stack     at TLSSocket.emit (events.js:310:20)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:917:8)
gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:687:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\dev\\source\\myproject\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\dev\\source\\myproject\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72" "--python=C:\\Python27" "--msvs_version=2017"
gyp ERR! cwd C:\dev\source\myproject\node_modules\sqlite3
gyp ERR! node -v v12.16.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\dev\source\myproject\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\dev\source\myproject\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72 --python=C:\Python27 --msvs_version=2017' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\dev\source\myproject\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\dev\\source\\myproject\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\dev\source\myproject\node_modules\sqlite3
node-pre-gyp ERR! node -v v12.16.2
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok

I've already tried some solution like strict-ssl=false but didn't find the solution that will work for me and still don't understand what is the root cause of this error.

I also tried to install some previous version on sqlite3 and got:

node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.1/node-v72-win32-x64.tar.gz
node-pre-gyp http unable to get local issuer certificate (falling back to source compile with node-gyp)

So I tried to make a direct GET request to this by changing the version from v3.1.1 to v4.1.1 and found out the following:

When making request with SSL certificate verification is on, the request fails, and when is off it success and downloads the file.

My conclusion is, there is an issue with certificate check on this package, and postman knows to handle it, the question is how to handle it on npm, specifically when running on windows.

来源:https://stackoverflow.com/questions/61304232/npm-install-sqlite3-gyp-error-unable-to-get-local-issuer-certificate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!