node.js - 无法在 OSX 10.6.8 上安装 Grunt

标签 node.js gruntjs homebrew

我对此很陌生。我想使用 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/

相关文章:

javascript - 如何最初仅扩展此 d3.js 中选定的 Node ?

Homebrew 程序:安装 php mcrypt

javascript - 使用 JavaScript 忽略 "a"、 "the"等的字符串搜索

javascript - yeoman/咕噜声 : adding subdirectories to project

javascript - JSHint - ^ 'concise methods' 在 ES6 中可用

testing - Mocha 在浏览器中通过测试,在命令行上失败

homebrew - 尝试使用brew安装mongodb时出错

java - 需要使用brew : Java 1. 7在Mac上安装Zeppelin

node.js - socket.io 1.0.0^ : Using the default room vs a custom room for user specific communications

node.js - 如何等待 promise ?