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
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
`-- [email protected]
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
Tried different suggestions from different references.
suggestion 1 from here - didn't work
This still gave the same error EACCES: permission denied
suggestion 2 from here - this worked
cookbook$ npm config get prefix
/usr
[~]
cookbook$
so this is issue and npm's recommendation is to change npm's default directory to another directory
Steps are as follows
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
After this ionic installation with cookbook$ npm install -g ionic cordova
got completed without any errors.
cookbook$ ionic -v
--------------------------------
cordova -v******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************
2.1.4
[~]
cookbook$ cordova -v
? May Cordova anonymously report usage statistics to improve the tool over time? Yes
Thanks for opting into telemetry to help us improve cordova.
6.4.0
[~]
cookbook$
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments