无法在ubuntu 18.04中安装web3

问题描述 投票:0回答:2

我使用以下命令在ubuntu 18.04中安装web3.js:

sudo npm install -g web3

并得到以下错误:

> [email protected] preinstall /usr/local/lib/node_modules/web3/node_modules/scrypt
> node node-scrypt-preinstall.js

Error: Error: Command failed: ./configure
./configure: line 1904: config.log: Permission denied
./configure: line 1914: config.log: Permission denied


> [email protected] install /usr/local/lib/node_modules/web3/node_modules/scrypt
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/web3/node_modules/scrypt/build'
gyp ERR! System Linux 4.15.0-45-generic
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/scrypt
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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!     /home/chakshu/.npm/_logs/2019-03-08T15_40_18_402Z-debug.log

虽然“sudo npm install -g [email protected]”工作正常,但我想要更新web3.js.请帮忙!

ubuntu npm ethereum web3
2个回答
0
投票

希望这可以帮助

sudo npm install --save web3 --unsafe-perm = true --allow-root


0
投票

@Kashish Khullar,您的解决方案适用于大多数软件包,但在我尝试安装drizzle时无效。现在我找到了这个的根本原因。我在我的Ubuntu 18.04中安装了带有binary的Nodejs,它显示了许多NPM软件包如Web3.js的上述错误。所以我从我的系统中完全卸载了Nodejs和npm,并再次使用apt-get包管理器安装它,即sudo apt install nodejs npm。现在一切正常,没有任何问题。

© www.soinside.com 2019 - 2024. All rights reserved.