0

我正在尝试通过 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?

4

1 回答 1

1

看起来你的本地.npm权限被搞砸了。只需运行以下命令删除 NPM 缓存:

sudo rm -rf /home/tom/.npm

然后再试一次。

于 2018-02-07T23:40:16.557 回答