-2
npm install -g ionic
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/ionic'
npm ERR!  { [Error: EACCES, mkdir '/usr/lib/node_modules/ionic']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/lib/node_modules/ionic',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/lib/node_modules/ionic',
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:107:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.2.0-72-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "ionic"
npm ERR! cwd /home/livemen
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/ionic
npm ERR! fstream_path /usr/lib/node_modules/ionic
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/ionic'
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:107: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.2.0-72-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "ionic"
npm ERR! cwd /home/livemen
npm ERR! node -v v0.10.33
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/livemen/npm-debug.log
npm ERR! not ok code 0
MrHug
  • 1,315
  • 10
  • 27

2 Answers2

0

Like the error says, try running this again as administrator, i.e. try sudo npm install -g ionic.

MrHug
  • 1,315
  • 10
  • 27
0

You run npm with user permissions (which is correct way) but it cannot create subdirectories inside /usr/lib. A recommended way to fix it is to change the ownership

sudo chown -R $USER /usr/lib

provided you are the only user who should install global node packages on your machine.

Resist the temptation to sudo npm :-)

See here for more details.

Community
  • 1
  • 1
Dmitri Zaitsev
  • 13,548
  • 11
  • 76
  • 110