[英]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.