So I installed Node.js by downloading the mac 0Sx package from their website, but now every time I try to run a command such as f$ grunt-cli -v
I get the following error below. This path /usr/local/bin/npm
also doesn't exist on my computer, and I don't know how to find node.js to unistall it, and then re-install it using homebrew. Let me know if I have left any info out.
-bash: grunt-cli: command not found
Sams-MacBook-Pro:~ SamDavidoff$ npm install -g grunt-cli
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! path /usr/local/lib/node_modules/grunt-cli
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/grunt-cli' }
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/grunt-cli'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: EACCES, rmdir '/usr/local/lib/node_modules/grunt-cli']
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/grunt-cli' }
npm ERR! Please include the following file with any support request:
npm ERR! /Users/SamDavidoff/npm-debug.log
EACCES
means you don't have root access. Reinstalling node/npm won't help. Like it says, try running it as admin:
sudo npm install -g grunt-cli
Or if you don't want to use sudo
, install nvm (note nvm may not allow you to globally install on mac, but it does on ubuntu so it might work):
$ git clone https://github.com/creationix/nvm.git ~/.nvm && cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`
$ ...
$ ~/.nvm/nvm.sh
$ ...
$ nvm install stable
$ ...
$ nvm use stable
$ npm install -g grunt-cli
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.