码迷,mamicode.com
首页 > 其他好文 > 详细

grunt错误——Fatal error: Unable to find Gruntfile

时间:2015-05-11 13:06:24      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:grunt   前端开发   uglify   gruntfile   error   

E:\website\jquery-plugins>grunt
A valid Gruntfile could not be found. Please see the getting started guide for
more information on how to configure grunt: http://gruntjs.com/getting-started
Fatal error: Unable to find Gruntfile.

错误提示Gruntfile.js文件找不到,但项目中已经有Gruntfile.js文件,后来发现是用npm安装grunt模块时,没有安装完整(可能是中途中断了安装,但grunt模块的目录已经存在与node_modules目录下),解决办法是重新安装grunt模块:

E:\website\jquery-plugins>npm install grunt

再次执行:

E:\website\jquery-plugins> grunt
Loading "uglify.js" tasks...ERROR
>> Error: ENOENT, no such file or directory ‘E:\website\jquery-plugins\node_modules\grunt-contrib-uglify\node_modules\uglify-js\lib\utils.src‘
Warning: Task "uglify" not found. Use --force to continue.

Aborted due to warnings.

错误提示没有这个文件或者目录,猜测gruntuglify插件也没有安装完整,重新安装:

E:\website\jquery-plugins>npm install grunt-contrib-uglify --save-dev

执行grunt的默认tasks(我这里的默认tasks只有uglify

E:\website\jquery-plugins>grunt
Running "uglify:build" (uglify) task
>> 1 file created.

Done, without errors.

grunt错误——Fatal error: Unable to find Gruntfile

标签:grunt   前端开发   uglify   gruntfile   error   

原文地址:http://blog.csdn.net/sspeed5cm/article/details/45641705

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!