Alessander França Alessander França - 1 year ago 98
Node.js Question

npm install is not working

I used this installation guide to install nodejs:

I am trying to use npm install and I had this error when I used this command:

npm install --global yo bower grunt-cli

npm ERR! Error: EACCES, mkdir '/home/alexfqc/.npm-packages/lib/node_modules'
npm ERR! { [Error: EACCES, mkdir '/home/alexfqc/.npm-packages/lib/node_modules']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/home/alexfqc/.npm-packages/lib/node_modules',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/home/alexfqc/.npm-packages/lib/node_modules/grunt-cli',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:23',
npm ERR! '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR! 'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

I was following the yeoman instructions, and there is a page for this error

After do this steps the error still continue.

Then I tried this commands:

sudo chmod -R 755 /home/alexfqc/.npm-packages
sudo chown -R root /home/alexfqc/.npm-packages

and did not work.

I am trying the entire day install nodejs correctly to use yeoman, bower and grunt but it seems impossible.

I tried other ways of installing nodejs but another error appeared.

I anyone could help to fix this error or show a way to install the nodejs, yeoman, bower and grunt I would be very grateful.

Answer Source

You have an access error, try using sudo npm install --global yo bower grunt-cli to perform install as root

Alternate - Instead of giving ownership of folder to root, give it to your user account with: sudo chown -R $USER /home/alexfqc/.npm-packages