在安装Web3js依赖项时,它显示node-gyp问题

时间:2019-01-19 18:14:54

标签: npm node-gyp web3 npm-scripts web3js

我正在尝试为我的项目安装web3js依赖项。但是node-gyp

出现了一个问题

下面是该错误的日志。

> scrypt@6.0.3 preinstall D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
> node node-scrypt-preinstall.js


> scrypt@6.0.3 install D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
> node-gyp rebuild


D:\Learning\BlockChain Project\Inbox\node_modules\scrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack     at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
gyp ERR! stack     at TLSSocket.emit (events.js:182:13)
gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:631:8)
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" "rebuild"
gyp ERR! cwd D:\Learning\BlockChain Project\Inbox\node_modules\scrypt
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN inbox@1.0.0 No description
npm WARN inbox@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the scrypt@6.0.3 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\Shashank\AppData\Roaming\npm-cache\_logs\2019-01-19T18_07_03_360Z-debug.log

2 个答案:

答案 0 :(得分:0)

在安装windows-build-tools及其依赖项之前先安装web3

    npm install --global --production windows-build-tools

参考:https://github.com/nodejs/node-gyp

答案 1 :(得分:0)

我必须安装上述windows-build-tools,但必须安装npm install --global --production windows-build-tools --vs2015,因为该工具的较新版本将无法正确编译具有node-gyp依赖项的web3 utils。几周前卸载了旧版本的Visual Studio 2015之后,我对此进行了一段时间的讨论。