ubuntu - 无法在 ubuntu 18.04 中安装 web3

标签 ubuntu npm ethereum web3

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

sudo npm install -g web3

并得到以下错误:
> scrypt@6.0.3 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


> scrypt@6.0.3 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! 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!     /home/chakshu/.npm/_logs/2019-03-08T15_40_18_402Z-debug.log

虽然“sudo npm install -g web3@0.20.7”工作正常,但我想要更新 web3.js。
请帮忙!

最佳答案

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

关于ubuntu - 无法在 ubuntu 18.04 中安装 web3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55067268/

相关文章:

php - 通过 PHP 与不同用户使用 SSH

npm - 如何使用全局安装的 gulp 模块?

javascript - 类型错误 : Cannot read property '_alreadyWrapped' of undefined

blockchain - 几天后,私有(private)以太坊区 block 链上的数据丢失/消失

c++ - "{ }"的 Visual Studio 代码格式

java - Tomcat 7 无法与 MySQL 5.5 建立数据库连接

ubuntu - 如何在本地 ubuntu14.04 上使用域名设置服务器?

javascript - 来自终端的 npm install 错误

node.js - 同时维护 Node.js 和 Electron 的原生模块依赖关系

javascript - 从 JavaScript 调用 Solidity 函数得到了 [对象 promise ]?