Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
533 views
in Technique[技术] by (71.8m points)

javascript - 导致此错误的原因是什么 - “致命错误:无法找到本地咕噜声”(What is causing this error - “Fatal error: Unable to find local grunt”)

I removed the old version of grunt first, then I installed the new grunt version, and then I got this error:

(我首先删除了旧版本的grunt,然后我安装了新的grunt版本,然后我收到了这个错误:)

D:\www\grunt-test\grunt grunt-cli: The grunt command line interface.

(D:\ www \ grunt-test \ grunt grunt-cli:grunt命令行界面。)

(v0.1.4)

((v0.1.4))

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.

(如果您看到此消息,则表示未找到Gruntfile或者您的项目未在本地安装grunt。)

For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-started

(有关安装和配置grunt的更多信息,请参阅“入门指南”: http//gruntjs.com/getting-started)

Is this because there is not a reference to grunt in my system path?

(这是因为我的系统路径中没有对grunt的引用吗?)

Or something else?

(或者是其他东西?)

I tried to re-install it a few times already.

(我试过几次重新安装它。)

  ask by Ryan Yiada translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think you don't have a grunt.js file in your project directory.

(我认为你的项目目录中没有grunt.js文件。)

Use grunt:init , which gives you options such as jQuery, node,commonjs .

(使用grunt:init ,它为您提供jQuery, node,commonjs等选项。)

Select what you want, then proceed.

(选择你想要的,然后继续。)

This really works.

(这确实有效。)

For more information you can visit this .

(有关更多信息,请访问此页面 。)

Do this:

(做这个:)

 1. npm install -g grunt
 2. grunt:init  ( you will get following options ):
      jquery: A jQuery plugin
      node: A Node module
      commonjs: A CommonJS module
      gruntplugin: A Grunt plugin
      gruntfile: A Gruntfile (grunt.js)
 3 .grunt init:jquery (if you want to create a jQuery related project.).

It should work.

(它应该工作。)

Solution for v1.4:

(v1.4的解决方案:)

1. npm install -g grunt-cli
2. npm init
   fill all details and it will create a package.json file.
3. npm install grunt (for grunt dependencies.)

Edit : Updated solution for new versions:

(编辑:更新了新版本的解决方案:)

 npm install grunt --save-dev

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...