我正在尝试通过npm安装web3。
sudo npm install -g web3
但我遇到了以下错误。
tom@ubuntu:/$ sudo npm install -g web3
npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise
Support
npm WARN deprecated tar.gz@1.0.7: ⚠️ WARNING ⚠️ tar.gz module has been
deprecated and your application is vulnerable. Please use tar module instead:
https://npmjs.com/tar
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b browserifyCompatible
git://github.com/frozeman/WebSocket-Node.git
/home/tom/.npm/_cacache/tmp/git-
clone-d38db07b
npm ERR! /home/tom/.npm/_cacache/tmp/git-clone-d38db07b/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tom/.npm/_logs/2018-02-07T14_42_37_459Z-debug.log
如何安装web3?
答案 0 :(得分:1)
看起来你的本地.npm
权限搞砸了。只需运行以下命令删除NPM缓存:
sudo rm -rf /home/tom/.npm
然后再试一次。