无法安装Grunt?

问题描述:

我已经安装了咕噜:无法安装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://*.com/questions/13925916/fatal-error-unable-to-find-local-咕噜) – Pracede

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

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

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

npm install -SD grunt 

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

+0

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

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

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

+0

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

  1. 安装的命令行界面:。 NPM安装-g咕噜-CLI
  2. 安装本地任务运行: CD [我的项目的根] NPM安装咕噜--save-dev的
  3. 定义Gruntfile.js按http://gruntjs.com/getting-started#the-gruntfile
  4. 运行任务:grunt