【问题标题】:Can't install Grunt on OSX 10.6.8无法在 OSX 10.6.8 上安装 Grunt
【发布时间】:2014-10-12 21:47:15
【问题描述】:

我是新手。我想使用 Grunt 来运行一些图像优化。但是由于某种原因我无法安装它。

我已经通过在终端中复制它来安装 Homebrew:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

我还在我的系统上安装了节点(通过下载 .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。

就像我说的那样,我对此很陌生,所以我刚在网上搜索的大部分内容。但是想不通这个。有人知道怎么回事吗?

谢谢! 约斯特

【问题讨论】:

  • ls -laF /usr/local/bin/npm 的输出是什么?
  • 嗨@GergoErdosi 它给出:ls: /usr/local/bin/npm?: 没有这样的文件或目录
  • 嗨@gearsdigital 感谢您的留言!在我尝试brew update 之后,我得到了这个:brew update You must: brew install git Error: Failure while executing: git init Joost:~ jvd$ brew install git Warning: Xcode is not installed. Most formulae need Xcode to build. It can be installed from https://developer.apple.com/downloads Error: git cannot be built with any available compilers.
  • 安装 xcode ;) 或者直接去获取捆绑了 npm 的 nodejs 安装程序 -> nodejs.org/download

标签: node.js gruntjs homebrew


【解决方案1】:

几周前这对我有用:

$ brew update
$ brew uninstall node
$ brew install node
$ sudo brew postinstall node 

如果您遇到任何访问错误,可能必须使用 sudo。有时通过自制软件安装节点会导致错误。因此,另一种选择是卸载它并下载 node.js 包并自行安装,无需自制软件。

【讨论】:

  • 您好@A.Alger Thans 为您解答。尝试过但无法解决。 brew update You must: brew install git Error: Failure while executing: git init Joost:~ jvd$ brew uninstall node Error: No such keg: /usr/local/Cellar/node
  • 试试这个:brew cleanup, brew link node, brew uninstall node, brew install node,
  • 嗨@a.alger 感谢您的评论尝试过:得到以下回复:Joost:~ jvd$ brew cleanup Joost:~ jvd$ brew link node Error: No such keg: /usr/local/Cellar/node
  • 嗨@A.Alger 通过终端安装了节点,但收到此安装后错误。 Warning: The post-install step did not complete successfully You can try again using brew postinstall node` ==> 摘要? /usr/local/Cellar/node/0.10.32: 1678 个文件,19M Joost:~ jvd$ brew postinstall node 错误:权限被拒绝 - /usr/local/lib/node_modules /npm/AUTHORS` 似乎无法用sudo brew postinstall node 修复它有什么想法吗?再次感谢!约斯特
  • 这很奇怪。我建议的唯一选择是不使用自制软件。也许只是通过 brew 卸载它,如果可以的话,然后从你可以从 node.js 下载的文件中安装它。 nodejs.org
猜你喜欢
  • 2013-05-08
  • 2012-01-11
  • 1970-01-01
  • 1970-01-01
  • 2013-02-06
  • 1970-01-01
  • 1970-01-01
  • 2012-04-17
  • 1970-01-01
相关资源
最近更新 更多