我知道很多人已经问过这个问题,但是我发现的答案都没有为我解决。
即使更新npm和node之后,我每次都会收到此错误。
我在Windows 7上,并且使用节点12.6.0和npm 6.9.2:
C:\Users\me\Desktop\graphQL>npm install sqlite3 --build-from-source
npm WARN lifecycle The node binary used for scripts is C:\Users\me\AppData\Roaming\npm\node_modules\node\bin\node.exe but npm is using C:\Program Files\nodejs\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> sqlite3@4.0.9 install C:\Users\me\Desktop\graphQL\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using request for node-pre-gyp https download
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: tunneling socket could not be established, statusCode=502
gyp ERR! stack at ClientRequest.onConnect (C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\tunnel-agent\index.js:166:19)
gyp ERR! stack at Object.onceWrapper (events.js:291:20)
gyp ERR! stack at ClientRequest.emit (events.js:203:13)
gyp ERR! stack at Socket.socketOnData (_http_client.js:485:11)
gyp ERR! stack at Socket.emit (events.js:203:13)
gyp ERR! stack at addChunk (_stream_readable.js:294:12)
gyp ERR! stack at readableAddChunk (_stream_readable.js:275:11)
gyp ERR! stack at Socket.Readable.push (_stream_readable.js:210:10)
gyp ERR! stack at TCP.onStreamRead (internal/stream_base_commons.js:166:17)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node\\bin\\node.exe" "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\me\\Desktop\\graphQL\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\me\\Desktop\\graphQL\\node_modules\\sqlite3\\lib\\binding\\node-v72-win32-x64" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd C:\Users\me\Desktop\graphQL\node_modules\sqlite3
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Users\me\AppData\Roaming\npm\node_modules\node\bin\node.exe C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\me\Desktop\graphQL\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\me\Desktop\graphQL\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\me\Desktop\graphQL\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:203:13)
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:283:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node\\bin\\node.exe" "C:\\Users\\me\\Desktop\\graphQL\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\me\Desktop\graphQL\node_modules\sqlite3
node-pre-gyp ERR! node -v v12.6.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Users\me\AppData\Roaming\npm\node_modules\node\bin\node.exe C:\Users\me\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\me\Desktop\graphQL\node_modules\sqlite3\lib\binding\node-v72-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\me\Desktop\graphQL\node_modules\sqlite3\lib\binding\node-v72-win32-x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sqlite3@4.0.9 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sqlite3@4.0.9 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Roaming\npm-cache\_logs\2019-07-04T12_43_34_601Z-debug.log