2016-04-15 97 views
1

我已经安装了咕噜:无法安装Grunt?

sudo npm install -g grunt-cli 
/Users/user/.nvm/versions/node/v4.3.0/bin/grunt -> /Users/user/.nvm/versions/node/v4.3.0/lib/node_modules/grunt-cli/bin/grunt 
/Users/user/.nvm/versions/node/v4.3.0/lib 
└── [email protected] 

但是当我运行的呼噜声,我有错误:

grunt 
grunt-cli: The grunt command line interface (v1.2.0) 

Fatal error: Unable to find local grunt. 

If you're seeing this message, grunt hasn't been installed locally to 
your project. For more information about installing and configuring grunt, 
please see the Getting Started guide: 

http://gruntjs.com/getting-started 

如果我错了吗?

+0

可能重复的[致命错误:无法找到本地咕噜声](http://stackoverflow.com/questions/13925916/fatal-error-unable-to-find-local-咕噜) – Pracede

回答

3

你必须在全球范围内安装咕噜和本地

你用-g标志将安装CLI全球

现在你必须在你的package.json与本地安装...

npm install -SD grunt 

那么你的“咕噜”命令将工作 - 假设你有一个有效的gruntfile

+0

谢谢你的回答,但我会结束这个问题,因为它重复 – Pracede

1

这看起来像的Fatal error: Unable to find local grunt重复。

简而言之,尝试运行grunt:initnpm:init第一(取决于你拥有的版本见链接的问题更多细节

+0

是的,它是重复的。我会关闭 – Pracede