npm仍然安装软件包到'/ usr / local / Cellar / node / …',尽pipe我已经卸载了Homebrew的版本节点
这是一个漫长的夜晚。 最初我从https://nodejs.org/上的软件包安装了节点。 然而,由于某种原因(我不记得为什么了),我决定尝试卸载,然后通过Homebrew安装节点。
一切似乎都很好。 然后我跑了以下几点:
$ npm install grunt -g $ npm install grunt-cli -g
但是当我尝试运行我的任何Grunt任务时,我得到以下内容:
$ cd /some/project/that/used/grunt $ grunt -bash: grunt: command not found
我试着卸载节点的Homebrew版本:
$ brew uninstall node
然后我再次安装了nodejs.org包。 但是,当我尝试安装npm软件包时,它将返回到/usr/local/Cellar/node/...
目录中:
$ sudo npm install grunt -g Password: grunt@0.4.5 /usr/local/Cellar/node/0.12.2_1/libexec/npm/lib/node_modules/grunt ├── which@1.0.9 ...
我也发现https://github.com/Homebrew/homebrew/issues/22408并尝试了符号链接:
$ ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
没有运气。 我怎样才能让npm停止在/usr/local/Cellar/...
安装软件包并让Grunt再次运行? 谢谢!
这似乎工作。 我在/usr/local/lib/node_modules/npm/npmrc
find了以下/usr/local/lib/node_modules/npm/npmrc
:
prefix=/usr/local/Cellar/node/0.12.2_1/libexec/npm
我删除了这一行,并重新安装了grunt
和grunt-cli
软件包。 它现在有效。