我对此很陌生。我想使用 Grunt 来运行一些图像优化。但由于某种原因我无法安装它。
我通过在终端中复制以下内容来安装 Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
我还在我的系统上安装了 Node(通过下载 .pkg 并安装它)。
当我检查 Homebrew 和 Node 是否已安装时,我得到以下信息:
Joost:~ jvd$ which brew
/usr/local/bin/brew
Joost:~ jvd$ which node
/usr/local/bin/node
当我尝试使用以下代码安装 Grunt 时: npm install -g grunt-cli 我得到(当我使用 $ sudo 时也是如此)
Joost:~ jvd$ npm install -g grunt-cli
-bash: npm: command not found
同样适用于:npm update -g npm。
就像我说的,我对此还很陌生,所以大部分内容都是我在网上搜索的。但无法弄清楚这一点。有人知道出了什么问题吗?
谢谢! 乔斯特
最佳答案
几周前这对我有用:
$ brew update
$ brew uninstall node
$ brew install node
$ sudo brew postinstall node
如果出现任何访问错误,可能需要使用 sudo。有时通过 Homebrew 程序安装 Node 会导致错误。因此,另一种选择是卸载它并下载 node.js 包并自行安装,无需 Homebrew 软件。
关于node.js - 无法在 OSX 10.6.8 上安装 Grunt,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26330343/