我怎样才能重新安装grunt在yeoman项目?

我的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并为这个项目安装一个全新的副本?

只要按照错误消息…例如你的说…

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

尝试安装grunt-autoprefixer …

 npm install grunt-autoprefixer --save 

然后再次运行grunt test

你会得到其他的错误信息…find缺less的东西…通过npm安装它。 有时你可能不得不谷歌正确的软件包名称…

您可能已经部分安装了在您的机器上caching的npm包。

尝试运行npm cache clean

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

然后尝试再次运行npm install