I'm getting the following error while installing ionic on ubuntu 12.04 LTS following instructions in http://ionicframework.com/docs/v2/getting-started/installation/
Commands used
install nodejs 6.x
cookbook$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
cookbook$ sudo apt-get install -y nodejs
cookbook$ node -v
v6.9.1
[~]
cookbook$ npm -v
3.10.8
[~]
install ionic per instructions
cookbook$ npm install -g ionic cordova
+-- readable-stream@1.0.34
| +-- core-util-is@1.0.2
| +-- inherits@2.0.3
| +-- isarray@0.0.1
| `-- string_decoder@0.10.31
`-- setimmediate@1.0.5
npm ERR! Linux 3.8.0-29-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "ionic" "cordova"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /home/cookbook/npm-debug.log
[~]
The error message suggests to try running this command again as root/Administrator.
What is the right way to go about this ?
similar issue on windows 10 here