繁体   English   中英

如何在Yeeoman项目中重新安装Grunt?

[英]How can I reinstall Grunt in a yeoman project?

我的Grunt安装发生了什么事,我不知道它是什么。 我正在使用Yeoman搭建我的应用程序,但是今天我开始遇到很多Grunt错误。 例如,当我运行Grunt Test时,我得到以下信息:

Loading "autoprefixer.js" tasks...ERROR
>> Error: Cannot find module 'base64-js'
Loading "connect.js" tasks...ERROR
>> Error: Cannot find module 'cookie-signature'
Loading "imagemin.js" tasks...ERROR
>> Error: Cannot find module './lib/js-yaml.js'
Loading "jshint.js" tasks...ERROR
>> Error: Cannot find module 'jshint'
Loading "uglify.js" tasks...ERROR
>> Error: Cannot find module './source-map/source-map-generator'
Loading "cdnify.js" tasks...ERROR
>> SyntaxError: /Users/Documents/Git/client/node_modules/grunt-google-cdn/node_modules/google-cdn/node_modules/cdnjs-cdn-data/external/cdnjs.json: Unexpected end of input
Loading "grunt-karma.js" tasks...ERROR
>> SyntaxError: /Users/Documents/Git/client/node_modules/karma/node_modules/socket.io/node_modules/engine.io/lib/server.js:390
>> });
>>    
>> Unexpected end of input
Loading "ngmin.js" tasks...ERROR
>> Error: Cannot find module 'estraverse'
Loading "svgmin.js" tasks...ERROR
>> SyntaxError: /Users/Documents/Git/client/node_modules/grunt-svgmin/node_modules/svgo/node_modules/js-yaml/lib/js-yaml/loader.js:950
>> });
>>  ^
>> Unexpected token )
Loading "usemin.js" tasks...ERROR
>> SyntaxError: /Users/Documents/Git/client/node_modules/grunt-usemin/node_modules/lodash/dist/lodash.js:5520
>> });
>> ^
>> Unexpected token }
Loading "css_sprite.js" tasks...ERROR
>> Error: Cannot find module 'async'
Warning: Task "autoprefixer" not found. Use --force to continue.

我已更新NPM,已尝试更新Grunt,已尝试安装Grunt找不到的所有那些软件包。 有没有办法核对并重新保存Grunt并为此项目安装全新的副本?

您可能已部分安装了缓存在计算机上的npm软件包。

尝试运行npm cache clean

然后删除安装的项目包: rm -rf node_modules

然后尝试再次运行npm install

只需按照错误消息进行操作即可,例如您说的话...

警告:找不到任务“ autoprefixer”。 使用--force继续。

尝试安装grunt-autoprefixer ...

npm install grunt-autoprefixer --save

然后再次运行grunt test ...

您会收到其他错误消息...找到缺少的内容...通过npm安装它。 有时您可能必须用Google搜索正确的软件包名称...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM