1

我无法在 linux mint 上使用 npm 安装 web3。我尝试了“npm --save install web3”并尝试重新安装,但是像以前一样发生错误。

npm 错误如下:

$ npm --save install web3
npm WARN checkPermissions Missing write access to /home/taylorec/node_modules
npm WARN checkPermissions Missing write access to /home/taylorec/node_modules/web3-providers-ws/node_modules
npm WARN enoent ENOENT: no such file or directory, open '/home/taylorec/package.json'
npm WARN taylorec No description
npm WARN taylorec No repository field.
npm WARN taylorec No README data
npm WARN taylorec No license field.

npm ERR! path /home/taylorec/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/home/taylorec/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/home/taylorec/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/home/taylorec/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/home/taylorec/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/taylorec/.npm/_logs/2018-01-29T14_59_11_864Z-debug.log
4

1 回答 1

0

我在 Linux Mint 18.3 Sylvia 上。我将节点降级到 v8.9.4,然后不知何故必须安装以下内容:

https://github.com/creationix/nvm/blob/master/README.md#installation $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash $ command -v nvm 如果安装成功应该输出'nvm'。

$ sudo apt-get install build-essential libssl-dev
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
$ sudo npm install --save mocha ganache-cli

$ sudo npm install --save web3@1.0.0-beta.26

npm 错误!命令失败:/usr/bin/git clone --depth=1 -q -b browserifyCompatible git://github.com/frozeman/WebSocket-Node.git /home/user1/.npm/_cacache/tmp/git-clone -f0c1b498 npm 错误!/home/user1/.npm/_cacache/tmp/git-clone-f0c1b498/.git: Permission denied 所以我不得不安装最新的 web3, web3@1.0.0-beta.29: $ npm install web3

在出现了很多关于 scrypt 的奇怪东西之后,它起作用了!Web3 已成功安装。

于 2018-01-31T11:40:27.653 回答