0

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
asked Sep 30, 2015 at 22:17

2 Answers 2

3

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
answered Sep 30, 2015 at 22:28

2 Comments

But isn't slightly wreckless to install things by overriding all permissions or is it common?
@user3236637 it isn't really "overriding" since root access is required to install things globally.
0

bash sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp

this should work

answered Jun 7, 2023 at 11:01

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.