Reputation: 55
I am trying to install ionic (or anything) with npm, and am getting errors everytime. Below is a copy of the error I get when trying to install ionic.
I have already tried uninstall/reinstall, but getting the same issue.
npm ERR! tar.unpack untar error /Users/csutaria/.npm/ionic/1.4.5/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v0.12.4
npm ERR! npm v2.10.1
npm ERR! path /usr/local/lib/node_modules/ionic
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/ionic'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/ionic']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/ionic',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/ionic',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! error rolling back Error: EACCES, rmdir '/usr/local/lib/node_modules/cordova'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, rmdir '/usr/local/lib/node_modules/cordova']
npm ERR! error rolling back errno: -13,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/cordova' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/csutaria/npm-debug.log
I could share the log file but it is HUGE. Let me know if a particular part of it would be useful to share or I can just copy the whole thing in.
Any help would be much appreciated!
-cs
Upvotes: 1
Views: 2081
Reputation: 1235
You're having issues because you don't have write access to the /usr/local
directory. A couple options to fix this:
Execute the install as root/administrator using sudo
sudo npm install -g cordova ionic
You can change ownership of the /usr/local
directory (and all subdirectories) to the current user, which is usually a fine solution on a single user machine:
sudo chown -R $USER /usr/local
You can change the file permissions on the directory recursively to allow universal write access (not so safe, but still not likely to cause issues)
sudo chmod -R a+w /usr/local
Alternatively, you could change the place where your npm install -g
command installs stuff, though you'll also probably have to mess with the PATH variable as well if you want access to the commands. To change the location where npm installs global modules, enter npm config edit
and then add a line that says
prefix=/path/to/new/location
Upvotes: 2