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

Javascript 如何在yeoman项目中重新安装Grunt?,javascript,node.js,gruntjs,npm,yeoman,Javascript,Node.js,Gruntjs,Npm,Yeoman,我的Grunt安装出了问题,我不知道是什么。我正在使用Yeoman搭建我的应用程序,但今天我开始收到许多咕哝错误。例如,我现在在运行Grunt测试时得到以下结果: Loading "autoprefixer.js" tasks...ERROR >> Error: Cannot find module 'base64-js' Loading "connect.js" tasks...ERROR >> Error: Cannot find module 'cookie-sig

我的Grunt安装出了问题,我不知道是什么。我正在使用Yeoman搭建我的应用程序,但今天我开始收到许多咕哝错误。例如,我现在在运行
Grunt测试时得到以下结果:

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自动刷新器

npm install grunt-autoprefixer --save
然后再次运行
grunt测试


您会收到其他错误消息…查找缺少的内容…通过npm安装。有时,您可能需要在谷歌上搜索正确的软件包名称…

只需按照错误消息…例如,您的软件包名称

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

尝试安装grunt自动刷新器

npm install grunt-autoprefixer --save
然后再次运行
grunt测试


您会收到其他错误消息…查找缺少的内容…通过npm安装。有时,您可能需要通过谷歌搜索正确的软件包名称…

您可能已经在计算机上缓存了部分npm软件包

尝试运行
npm缓存清理

然后删除已安装的项目包:
rm-rf节点模块


然后再次尝试运行
npm install

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

尝试运行
npm缓存清理

然后删除已安装的项目包:
rm-rf节点模块


然后再次尝试运行
npm install

起初我以为我会这样做,但所有“缺失”的软件包实际上都已安装。另外,我尝试运行
npm install
来重新安装它们,但没有任何改变。起初我以为我会这样做,但所有“缺失”的软件包都已安装。此外,我尝试运行
npm install
重新安装它们,但没有任何改变。这解决了我的问题-在npm更新失败后,我对npm有了一些乐趣。以上步骤很有效,谢谢你。这解决了我的问题——在npm更新失败后,我对npm有了一些乐趣。以上步骤很有效,谢谢你,艾萨克