web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

npm install web3 node-gyp permission denied

Open aas312 opened this issue 8 years ago • 5 comments

Trying to install web3 on Ubuntu 17.04 node version 8.2.0 and npm version 5.6.0

~/web3v1sandbox$ npm install web3

> [email protected] preinstall /home/myuser/web3v1sandbox/node_modules/scrypt
> node node-scrypt-preinstall.js


> [email protected] install /home/myuser/web3v1sandbox/node_modules/scrypt
> node-gyp rebuild

/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: Permission denied
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 126
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.
~/web3v1sandbox$ npm install web3

> [email protected] preinstall /home/myuser/web3v1sandbox/node_modules/scrypt
> node node-scrypt-preinstall.js


> [email protected] install /home/myuser/web3v1sandbox/node_modules/scrypt
> node-gyp rebuild

/usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: 5: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp: /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js: Permission denied
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 126
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.

aas312 avatar Dec 14 '17 17:12 aas312

did you check here? I've found a solution there for similar problem I had on mac.

makc avatar Dec 23 '17 12:12 makc

It's likely that node was installed as root which is why you're running into a permission issue. Try running command with sudo.

christopherdro avatar Dec 25 '17 02:12 christopherdro

$ sudo npm install --save package_name --unsafe-perm=true --allow-root This works for me on my Linux Mint/Ubuntu system

ghost avatar Mar 16 '18 12:03 ghost

@zidzid1234 Your solution worked when I added web3 at the end, cheers! (maybe it was obvious)

jctaillandier avatar Mar 25 '18 01:03 jctaillandier

i deleted .npm from home directory by type ctl-h and then deleted the .npm folder and again run the npm install web3 (ubuntu 16.04) and if not worked just delete .npm from home directory and type sudo su then run npm install web3

chandu333 avatar Jul 27 '18 12:07 chandu333