尝试使用npm安装web3时出现EACCES权限错误

时间:2018-01-29 15:04:11

标签: npm-install web3

我无法在linux mint上使用npm安装web3。 我试过  ns --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

1 个答案:

答案 0 :(得分: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 |庆典     $ 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 ERR!命令失败:/ usr / bin / git clone --depth = 1 -q -b browserifyCompatible git://github.com/frozeman/WebSocket-Node.git /home/user1/.npm/_cacache/tmp/git-clone -f0c1b498 错误的ERR! /home/user1/.npm/_cacache/tmp/git-clone-f0c1b498/.git:权限被拒绝 所以我必须安装最新的web3,web3 @ 1.0.0-beta.29:     $ npm install web3

关于scrypt出现的许多奇怪的东西,然后它工作了! Web3已成功安装。