我正在进行干净的 Windows 10 安装。尝试npm install sqlite3
从myproject
路径运行时,出现以下错误:
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
我已经尝试过一些解决方案,strict-ssl=false
但没有找到适合我的解决方案,但仍然不明白这个错误的根本原因是什么。
我还尝试在 sqlite3 上安装一些以前的版本并得到:
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)
因此,我尝试通过将版本从 更改为直接 GET 请求,v3.1.1
并v4.1.1
发现以下内容:
使用 is 发出请求时SSL certificate verification
,on
请求失败,何时off
成功并下载文件。
我的结论是,这个包的证书检查存在问题,邮递员知道要处理它,问题是如何在 npm 上处理它,特别是在 Windows 上运行时。