问题
- 碰见过下列错误吗?
localhost:~ yangqiang$ sudo npm --registry https://registry.npm.taobao.org install web3 -g --unsafe-perm
Password:
> keccak@2.1.0 install /usr/local/lib/node_modules/web3/node_modules/keccak
> npm run rebuild || echo "Keccak bindings compilation fail. Pure JS implementation will be used."
> keccak@2.1.0 rebuild /usr/local/lib/node_modules/web3/node_modules/keccak
> node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/web3/node_modules/keccak
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@2.1.0 rebuild: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@2.1.0 rebuild 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! /Users/yangqiang/.npm/_logs/2020-03-24T08_34_43_162Z-debug.log
Keccak bindings compilation fail. Pure JS implementation will be used.
> secp256k1@3.8.0 install /usr/local/lib/node_modules/web3/node_modules/secp256k1
> npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."
> secp256k1@3.8.0 rebuild /usr/local/lib/node_modules/web3/node_modules/secp256k1
> node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
- 关键点:
gyp: No Xcode or CLT version detected!
解决办法
-
安装xcode命令行编译开发工具
- 每次xcode更新都要来一把。
-
使用如下命令:
xcode-select --install
- 安装需要一定时间。
-
如果上面工具没有效果,请先执行:
sudo rm -rf $(xcode-select -print-path)
-
操作截图:
- 安装开发命令行工具
-
安装web3的问题解决了。
网友评论