我习惯grunt build
任务成功完成,但由于我将项目编辑与其他开发人员同事合并,因此突然失败并出现了我以前从未见过的错误:
grunt build
Loading "imagemin.js" tasks...ERROR
>> Error: Cannot find module 'process-nextick-args'
Loading "cdnify.js" tasks...ERROR
>> Error: Cannot find module 'abbrev'
Loading "grunt-karma.js" tasks...ERROR
>> Error: Cannot find module 'uglify-js'
Running "clean:dist" (clean) task
>> 0 paths cleaned.
Running "wiredep:app" (wiredep) task
Warning: Cannot find module './lang/clone' Use --force to continue.
Aborted due to warnings.
Execution Time (2015-09-25 09:44:30 UTC)
wiredep:app 31ms
Total 31ms
在Gruntfile.js中,我在imagemin
和cdnify
任务中评论了concurrent:dist
和build
。
我做错了什么?
这里有一些关于我正在使用的东西版本的信息:
node -v && npm -v && grunt --version
v0.10.35
2.1.1
grunt-cli v0.1.13
grunt v0.4.5
此外,我尝试在npm install
之前运行grunt build
,但我有以前从未见过的这些警告,除了三个警告:
npm WARN package.json rwui@0.0.0 No description
npm WARN package.json rwui@0.0.0 No repository field.
npm WARN package.json rwui@0.0.0 No README data
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\vinyl-fs\node_modules\glob-watcher\node_modules\gaze\node_modules\globule\node_modules\glob requires graceful-fs@'~1.2.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\vinyl-fs\node_modules\graceful-fs,
npm WARN unmet dependency which is version 3.0.8
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-build\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-build\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-wrapper\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_modules\bin-wrapper\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-build\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-build\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-jpegtran\node_modules\jpegtran-bin\node_modules\bin-wrapper\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-build\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-build\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-wrapper\node_modules\download\node_modules\gulp-decompress\node_modules\gulp-util requires object-assign@'^3.0.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-optipng\node_modules\optipng-bin\node_modules\bin-wrapper\node_modules\download\node_modules\object-assign,
npm WARN unmet dependency which is version 4.0.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\bower\node_modules\inquirer\node_modules\chalk\node_modules\has-ansi requires ansi-regex@'^0.2.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\bower\node_modules\inquirer\node_modules\ansi-regex,
npm WARN unmet dependency which is version 1.1.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\bower\node_modules\inquirer\node_modules\chalk\node_modules\strip-ansi requires ansi-regex@'^0.2.1' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\bower\node_modules\inquirer\node_modules\ansi-regex,
npm WARN unmet dependency which is version 1.1.1
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\google-cdn\node_modules\bower requires chalk@'0.5.0' but will load
npm WARN unmet dependency C:\Users\gesposito\Documents\Developer\Software\Production\reportmed\api_ui\node_modules\grunt-google-cdn\node_modules\chalk,
npm WARN unmet dependency which is version 0.5.1
修改
我离开这里package.json
的相关部分:
"devDependencies": {
"grunt": "^0.4.5",
"grunt-autoprefixer": "^2.1.0",
"grunt-concurrent": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compass": "^1.0.1",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-cssmin": "^0.11.0",
"grunt-contrib-htmlmin": "^0.3.0",
"grunt-contrib-imagemin": "^0.9.2",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.7.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-filerev": "^2.1.2",
"grunt-google-cdn": "^0.4.3",
"grunt-karma": "^0.10.1",
"grunt-newer": "^1.1.0",
"grunt-ng-annotate": "^0.8.0",
"grunt-svgmin": "^2.0.0",
"grunt-usemin": "^3.0.0",
"grunt-wiredep": "^2.0.0",
"jasmine-core": "^2.2.0",
"jshint-stylish": "^1.0.0",
"karma": "^0.12.31",
"karma-chrome-launcher": "^0.1.8",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "^0.1.4",
"load-grunt-tasks": "^2.0.0",
"time-grunt": "^1.0.0"
},
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "grunt test"
}
修改
请注意,我的同事package.json
与我的同事没有任何区别。
答案 0 :(得分:6)
看起来你已经过时/混合了npm模块 - 你和同事合并了your node_modules
文件夹吗?
无论如何,我建议删除你的本地node_modules目录,然后重新运行npm install
。
再次稳定后,正确的工作流程应为:
node_modules
应该不受源代码管理npm install
来设置您的本地node_modules
package.json
更改npm update
以在本地安装新版本答案 1 :(得分:0)
执行install grunt-google-cd@0.3.0
安装版本0.3.0有些组件没有更新版本