“致命错误:无法找到本地咕噜声”。在Windows 7上 [英] "Fatal error: Unable to find local grunt." on Windows 7

查看:164
本文介绍了“致命错误:无法找到本地咕噜声”。在Windows 7上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows 7上我根本无法工作。按照Grunt网站上的说明( http://gruntjs.com/getting我已经运行了:

  npm uninstall -g grunt-cli 
npm uninstall grunt
npm uninstall -g grunt-init

git clone git@github.com:gruntjs / grunt-init -jquery.git c:/Users/me/.grunt-init/jquery

npm install -g grunt-cli
grunt-init jquery
npm install。

之后,运行grunt会产生以下输出:

  grunt-cli:grunt命令行界面。 (v0.1.9)

致命错误:无法找到本地咕噜声。

如果您看到此消息,找不到Gruntfile,或者grunt
没有在本地安装到您的项目中。有关
安装和配置grunt的更多信息,请参阅入门指南:

http://gruntjs.com/getting-started

npm list grunt的输出是:

  npm WARN package.json consolidate@0.9.1没有版本库字段。 
npm WARN package.json jquery-plugin@0.0.0-ignored没有存储库字段。
npm WARN package.json passport-local-examples-login@0.0.0没有存储库字段。
npm WARN package.json receiptly@0.0.1无资料库字段。
npm WARN package.json cookie-signature@1.0.1无资料库字段。
npm WARN package.json fresh@0.1.0没有存储库字段。
npm WARN package.json methods@0.0.1没有存储库字段。
npm WARN package.json range-parser@0.0.4无资料库字段。
npm WARN package.json send@0.1.0没有存储库字段。
npm WARN package.json pause@0.0.1无资料库字段。
npm WARN package.json policyfile@0.0.4'repositories'(复数)不支持。
npm WARN package.json请选择一个作为'repository'字段
npm WARN package.json eyes@0.1.8无版本库字段。
npm WARN package.json bytes@0.2.0没有存储库字段。
npm WARN package.json dateformat@1.0.2-1.2.3没有存储库字段。
npm WARN package.json uid2@0.0.2没有存储库字段。
C:\ Users \\\\ Application \\\\'\\\\\'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ b

在当前目录中运行npm install grunt会在运行grunt时出现相同的错误。



有什么想法?我的理解是,grunt-cli是为了寻找一个本地grunt安装,但我无法弄清楚它为什么找不到它。

解决方案

我知道这个问题被问了2年了。但是,如果有人想在未来:

我得到了完全相同的问题。我通过安装grunt 本地来解决这个问题。按照grunt 网站 $ b


请注意,安装grunt-cli不会安装Grunt任务运行器!
Grunt CLI的工作很简单:运行安装了
的Grunt版本,安装在Gruntfile旁边。这允许多个版本的
Grunt同时安装在同一台机器上。


所以我通过安装

  npm install grunt --save-dev 
$ b保存:将它添加到你的package.json中。

-dev:将它作为开发依赖项添加。


I cannot get grunt to work at all on Windows 7. Following the instructions on the Grunt website (http://gruntjs.com/getting-started) I've run:

npm uninstall -g grunt-cli
npm uninstall grunt
npm uninstall -g grunt-init

git clone git@github.com:gruntjs/grunt-init-jquery.git c:/Users/me/.grunt-init/jquery

npm install -g grunt-cli
grunt-init jquery
npm install .

After that, running "grunt" produces the following output:

grunt-cli: The grunt command line interface. (v0.1.9)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or 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

The output of npm list grunt is:

npm WARN package.json consolidate@0.9.1 No repository field.
npm WARN package.json jquery-plugin@0.0.0-ignored No repository field.
npm WARN package.json passport-local-examples-login@0.0.0 No repository field.
npm WARN package.json receiptly@0.0.1 No repository field.
npm WARN package.json cookie-signature@1.0.1 No repository field.
npm WARN package.json fresh@0.1.0 No repository field.
npm WARN package.json methods@0.0.1 No repository field.
npm WARN package.json range-parser@0.0.4 No repository field.
npm WARN package.json send@0.1.0 No repository field.
npm WARN package.json pause@0.0.1 No repository field.
npm WARN package.json policyfile@0.0.4 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm WARN package.json eyes@0.1.8 No repository field.
npm WARN package.json bytes@0.2.0 No repository field.
npm WARN package.json dateformat@1.0.2-1.2.3 No repository field.
npm WARN package.json uid2@0.0.2 No repository field.
C:\Users\me\AppData\Roaming\npm
└─┬ grunt-init@0.2.1
  └── grunt@0.4.1

Running "npm install grunt" in the current directory gives the same error when running grunt.

Any thoughts? My understanding is that grunt-cli is meant to look for a local grunt install, but I can't work out why it can't find it.

解决方案

I know its been 2 years since this question was asked. However if someone wants in future:

I got the exact same issue. And I got this fixed by installing grunt locally. As per grunt site,

Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.

So I just got it working by installing Grunt locally.

npm install grunt --save-dev

--save : adds it to your package.json.

-dev: adds it as a dev dependency.

这篇关于“致命错误:无法找到本地咕噜声”。在Windows 7上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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