EACCESS Error when doing npm install -g bower - node.js

When i run a command with -g (global) installation i get EACCESS errors . I read on one of the stack overflow answers that i should use 'sudo chown -R whoami ~/.npm' to run as local/root adminstrator but it didnt help
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/.node/lib/node_modules/bower/.editorconfig'
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! cwd /Users/Documents/tutorials/bookingappdemo
npm ERR! node -v v0.10.29
npm ERR! npm -v 2.0.0-alpha-5
npm ERR! path /Users/.node/lib/node_modules/bower/.editorconfig
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/Users/.node/lib/node_modules/bower/.editorconfig'
npm ERR! Additional logging details can be found in:
npm ERR! not ok code 0

If you are an administrator I suggest you run the command as root:
sudo npm install -g bower

I used --unsafe-perm with install e.g
sudo npm install -g learnyounode --unsafe-perm
this helped me install without permissions error, hope this is fixed soon.

Related

Getting error like 'Error eacces mkdir' while run 'npm install -g create-react-app' command

When I try to install reactjs by npm install -g create-react-app command in Ubuntu I am getting an error as following. please help me remove these error.
giving me this error-
npm ERR! Error: EACCES, mkdir '/home/veomit10/tmp/npm-6710-iquektSI'
npm ERR! { [Error: EACCES, mkdir '/home/veomit10/tmp/npm-6710-iquektSI']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/veomit10/tmp/npm-6710-iquektSI' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 4.4.0-144-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "react-native-cli"
npm ERR! cwd /home/veomit10/reactApp
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /home/veomit10/tmp/npm-6710-iquektSI
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/veomit10/tmp/npm-6710-iquektSI'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/veomit10/reactApp/npm-debug.log
npm ERR! not ok code 0
Thanks in advance.
it seems you are trying to install it from a non-root user so in this case, you have to have the root permissions in order to install a global node modules.
just try to run commands from the root user, run this first
sudo su
after that run:
npm install -g create-react-app
if you still having error '/usr/bin/env: node: No such file or directory'
try to run this command ln -s /usr/bin/nodejs /usr/bin/node and re install creat-react-app again.

npm ERR! when trying to install gulp-jshint

When I try to install a npm package I receive the error:
MacBook-Pro-van-Jamie:gulp Egen$ npm install gulp-jshint –save-dev
npm ERR! addLocal Could not install /Users/Egen/Code/gulp/–save-dev
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "gulp-jshint" "–save-dev"
npm ERR! node v5.9.0
npm ERR! npm v3.7.3
npm ERR! The header content contains invalid characters
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
I've set the right permissions at /usr/local/lib/node_modules like this:
sudo chown -R Egen /usr/local/
What could be the problem?
The error is a result of an incorrect command. You typed:
npm install gulp-jshint -save-dev
This causes npm to try to install the packages gulp and -save-dev.
The correct command should be:
npm install gulp-jshint --save-dev

Error installing modules for node.js

I installed node and everything was ok, but when I've tried to install stylus, for example didn't allow me to do it with :nmp install -g stylus, only with :npm install stylus.
When I try to compile estilos.styl anywhere, then the console gives me
"command not found"
I tried to install stylus in the local folder too, but still same error. Same happens with grunt-cli or any module I try to install with node.
These are the errors:
iMac-de-Eva:~ eva$ npm install stylus -g npm ERR! Error: EACCES, mkdir
'/usr/local/lib/node_modules/stylus' npm ERR! { [Error: EACCES, mkdir
'/usr/local/lib/node_modules/stylus'] npm ERR! errno: 3, npm ERR!
code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/stylus',
npm ERR! fstream_type: 'Directory', npm ERR! fstream_path:
'/usr/local/lib/node_modules/stylus', npm ERR! fstream_class:
'DirWriter', npm ERR! fstream_stack: npm ERR! [
'/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!
'/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm
ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.5.0 npm ERR! command "node"
"/usr/local/bin/npm" "install" "stylus" "-g" npm ERR! cwd /Users/eva
npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! path
/usr/local/lib/node_modules/stylus npm ERR! fstream_path
/usr/local/lib/node_modules/stylus npm ERR! fstream_type Directory npm
ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! errno 3 npm
ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/stylus'
npm ERR! fstream_stack
/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack
/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53 npm
ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR!
Additional logging details can be found in: npm ERR!
/Users/eva/npm-debug.log npm ERR! not ok code 0
If you're trying to install globally (which is what the -g switch means) you may have to use sudo: sudo npm install -g [module-name]
EACASSS error means you do not have permissions.
To install globally you need to have elevated permissions, this will help:
sudo npm install -g stylus
It will ask you for the password for security reasons.
Installing locally works without permissions, but as you noticed, command stylus is not found, because it is installed locally and not included into your $PATH.
Try to install using this:
npm install --save [module-name]

pm2 installation results in error

I want to install pm2 globally to run my nodejs app. my os is ubuntu 14.04 64bit and node version 0.10.33.
when i run the command npm install pm2 -g it gives the following error
npm ERR! pm2#0.11.1 preinstall: `bash ./scripts/preinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pm2#0.11.1 preinstall script.
npm ERR! This is most likely a problem with the pm2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bash ./scripts/preinstall.sh
npm ERR! You can get their info via:
npm ERR! npm owner ls pm2
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pm2" "-g"
npm ERR! cwd /home/ubuntu
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0
ubuntu#ip-172-31-40-58:~$
Try adding sudo
sudo npm install pm2 -g
or
sudo npm install pm2 -g --unsafe-perm

"sudo npm install -g grunt-cli" gives me an error

I get an error when trying to install gruntjs on a linux 12.04 (with a mirrored packages source)
Here is the error:
sudo npm install -g grunt-cli
npm ERR! Error: ENOENT, open '/home/havetl/.npm/d63f3d0b-grunt-cli.lock'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/havetl/.npm/d63f3d0b-grunt-cli.lock
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR! { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "grunt-cli"
npm ERR! cwd /home/havetl
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/havetl/npm-debug.log
npm ERR! not ok code 0
Thanks for any idea!
According to the maintainer of npm, installing packages with sudo is considered bad practice because you are allowing that package to have complete control of your system and you can't and SHOULDN'T trust these packages with root access. Think Debian's long release cycles as an extreme example of protecting end users from community maintained packages for this exact reason.
http://howtonode.org/introduction-to-npm
You should do what Issaacs suggests and chown your /usr/local folder so you have RW permissions.
I've had this problem before; sometimes for global packages your current working directory has to be ~/ (but I'm not sure why this is!). Try:
cd ~/; sudo npm install -g grunt-cli
This blog worked for me :
http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/
the error was because in ubuntu v12 few of the dependencies were not available for the latest version of Node.

Resources