1
votes

When i'm installing ember-cli with this command "npm install -g ember-cli" showing this error in terminal.

npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/ember-cli'
npm ERR!  { [Error: EACCES, mkdir '/usr/lib/node_modules/ember-cli']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/lib/node_modules/ember-cli',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/lib/node_modules/ember-cli',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36: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.

npm ERR! System Linux 3.13.0-48-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/narayand4
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/ember-cli
npm ERR! fstream_path /usr/lib/node_modules/ember-cli
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/lib/node_modules/ember-cli'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
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.13.0-48-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "ember-cli"
npm ERR! cwd /home/narayand4
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
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/narayand4/npm-debug.log
npm ERR! not ok code 0

please suggest me what i doing wrong?

3
use sudo. your user doesnt have permissions...aet
Fix your npm installation, you shouldn't require to sudo npmPatsy Issa
Thanks Kitler, I think you are right. The main issue with npm installation.Durgesh Narayan

3 Answers

4
votes

This is a known issue with some installers, here's the documentation on fixing npm permissions.
If you're curious to learn more, the npm developers have recently talked about it on JavaScript Jabber #174.

0
votes

The -g flag to node does a global install on the machine. As such it requires permissions to write at least to /usr/lib.

So if you want to install with the -g option, do so as an administrative user, usually root. Sudo is a good way of doing that.

If you are not the administrator of the machine or are otherwise trying to install in your local directory, remove the -g flag.

If you are not the administrator and need it installed globally, contact your system administrator.

0
votes

I have researched on google the main issue was npm installation. I think, does not require "sudo" for npm installation.