[英]Attempt to install Amber.js on OS X fails because grunt client not installed?
I have installed node.js and npm on my OS X box running 10.11.5.我已经在运行 10.11.5 的 OS X 机器上安装了 node.js 和 npm。 But, following the instructions at http://docs.amber-lang.net/getting-started.html , when I type:
但是,当我输入以下内容时,请按照http://docs.amber-lang.net/getting-started.html 上的说明进行操作:
npm install -g amber-cli npm install -g amber-cli
in the Terminal, I get the following result:在终端中,我得到以下结果:
npm WARN amber-cli@0.100.2 requires a peer of grunt-cli@^0.1.13 but none was installed. npm WARN amber-cli@0.100.2 需要 grunt-cli@^0.1.13 的同级,但没有安装。
And the installation halts.并且安装停止。 Since this is only a warning from npm, I wonder if I really need grunt installed.
由于这只是来自 npm 的警告,我想知道我是否真的需要安装 grunt。
FWIW, it does appear I have a version of grunt in my npm directory because using locate to find it produces a billion lines, one of which is: FWIW,我的 npm 目录中似乎确实有一个 grunt 版本,因为使用 locate 查找它会产生十亿行,其中之一是:
/Users/me/.npm/grunt /用户/我/.npm/grunt
In fact, it looks like I have a bunch of grunt installs (most version 0.4.0).事实上,看起来我有一堆 grunt 安装(大多数版本是 0.4.0)。 Which makes me reluctant to install grunt again since it doesn't seem to work anyway.
这让我不愿意再次安装 grunt ,因为它似乎无论如何都不起作用。
试试下面的命令
npm install -g grunt-cli@0 grunt-init bower amber-cli
More than likely, it's a problem with your path.很有可能是你的路径有问题。
If nothing returns when you execute which grunt
, it means that you need to add the location of grunt to your path.如果执行
which grunt
时没有任何返回,则意味着您需要将 grunt 的位置添加到您的路径中。
If you installed grunt using npm install -g
, you'll need to add /usr/local/bin
to your path.如果您使用
npm install -g
安装了 grunt,则需要将/usr/local/bin
到您的路径中。
Since you found your grunt cli under ~/.npm
, you will need to add that to your path.由于您在
~/.npm
下找到了 grunt cli,因此您需要将其添加到您的路径中。
You should also add ./node_modules/bin
to your path which will cause your shell to check for npm-installed modules in the node_modules/bin
directory in your current directory.您还应该将
./node_modules/bin
添加到您的路径中,这将导致您的 shell 在您当前目录的node_modules/bin
目录中检查 npm 安装的模块。
You can always run grunt directly, irrespective of its location, by typing: npx grunt
using the tool included with npm
for running npm-installed commands.你总是可以直接运行 grunt,而不管它的位置,通过键入:
npx grunt
使用npm
附带的工具运行 npm 安装的命令。
It's good practice to add all of the paths above, to catch all possible npm-installed commands.添加上述所有路径以捕获所有可能的 npm 安装命令是一种很好的做法。
You can update your path in the ~/.*rc
file for your shell (~/.bashrc for bash, etc.), by adding this line to the end of your rc file:您可以通过将此行添加到 rc 文件的末尾来更新 shell 的
~/.*rc
文件中的路径(bash 的 ~/.bashrc 等):
export PATH=/usr/local/bin:~/.npm:./node_modules/bin:$PATH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.