It's been a long night. Originally I had node installed from the package on https://nodejs.org/. However, for some reason (I can't remember why now!), I decided to try uninstalling this and then installing node through Homebrew.
Everything seemed to go fine. I then ran the following:
$ npm install grunt -g
$ npm install grunt-cli -g
But then when I tried running any of my Grunt tasks I get the following:
$ cd /some/project/that/used/grunt
$ grunt
-bash: grunt: command not found
I tried uninstalling the Homebrew version of node:
$ brew uninstall node
I then installed the nodejs.org package again. However when I try to install an npm package it ends up back in the /usr/local/Cellar/node/...
directory:
$ sudo npm install grunt -g
Password:
[email protected] /usr/local/Cellar/node/0.12.2_1/libexec/npm/lib/node_modules/grunt
├── [email protected]
...
I also found https://github.com/Homebrew/homebrew/issues/22408 and tried the symlink:
$ ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
No luck. How can I get npm to stop installing packages in /usr/local/Cellar/...
and get Grunt running again? Thank you!
This seemed to work. I found the following in /usr/local/lib/node_modules/npm/npmrc
:
prefix=/usr/local/Cellar/node/0.12.2_1/libexec/npm
I removed this line and re-installed the grunt
and grunt-cli
packages. It works now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With