在安装使用npm后无法运行grunt [英] unable to run grunt after installing using npm

查看:869
本文介绍了在安装使用npm后无法运行grunt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装并使用grunt。



我使用npm install grunt -g安装

似乎要安装 -

  grunt@0.4.3 /Users/me/.node/lib/node_modules/grunt 

当我在终端中打开一个新标签并运行grunt时,我得到

  -bash:grunt:找不到命令

我的路径如下所示

  $ echo $ PATH 
/Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/bin:/ sbin目录:在/ usr / bin中:在/ usr / local / sbin中:在/ usr / local / bin目录:在/ usr /本地/ MySQL的/斌:在/ usr /本地/ MySQL的/斌:在/ usr / bin中:/ bin中:在/ usr / sbin:/ sbin:/ usr / local / bin:/ opt / X11 / bin:/ usr / local / git / bin

有什么建议吗?这是在杀我。






我也安装了grunt-cli,仍然无法使用 -

  npm install grunt-cli -g 

/Users/me/.node/bin/grunt - > /Users/me/.node/lib/node_modules/grunt-cli/bin/grunt

我打开一个新标签

  -bash:grunt:找不到命令






我使用节点安装程序安装节点。我在OSX上。



我刚把/.node/bin加到我的路径中,见下面 -

  echo $ PATH 
/Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/.node/bin:/bin:/sbin:/usr/bin:在/ usr / local / sbin中:在/ usr / local / bin目录:在/ usr /本地/ MySQL的/斌:在/ usr /本地/ MySQL的/斌:在/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录:/ USR /local/bin:/.node/bin:/opt/X11/bin:/usr/local/git/bin

它仍然不起作用。

解决方案

您的路径不包含〜/ .node / bin,显然您的全局安装的npm二进制文件是保留的。



如果您希望所述二进制文件被拾取,您需要解决该问题。无论哪种方式,这指出你在node / npm安装中错过了一步。你是如何精确安装节点的?



我不知道其他人做了什么,但是我正在使用来自自制软件,它应该为你处理这个问题(我从你列出的你在OSX上的路径推测)。


I'm trying to install and use grunt.

I install using npm install grunt -g

it seems to install -

grunt@0.4.3 /Users/me/.node/lib/node_modules/grunt

when I open up a new tab in terminal and run grunt I get

 -bash: grunt: command not found

My path looks like this

$ echo $PATH
            /Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin 

Any advice? This is killing me.


I've installed grunt-cli too, still not working -

 npm install grunt-cli -g

/Users/me/.node/bin/grunt -> /Users/me/.node/lib/node_modules/grunt-cli/bin/grunt

I open a new tab

-bash: grunt: command not found


I installed node using the node installer. I'm on OSX.

I've just added /.node/bin to my path, see below -

 echo $PATH
 /Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/.node/bin:/bin:/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/.node/bin:/opt/X11/bin:/usr/local/git/bin

It's still not working.

解决方案

Your path don't contain ~/.node/bin where apparently your globally installed npm binaries are kept.

You need to fix that if you expect said binaries to be picked-up.

Either way, this points out that you missed a step in your node / npm installation. How did you installed node exactly?

I don't know what other people do, but I'm using node from homebrew, which should take care of that for you (I assume from the paths you list that you are on OSX).

这篇关于在安装使用npm后无法运行grunt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆