【发布时间】: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