我正在为NodeJS应用设置持续集成/持续部署,并且在npm安装/依赖关系管理方面存在一些问题。
但是,当我从Travis或CodeShip下载软件包时,尝试运行npm脚本,例如npm install或npm start,我得到依赖错误。
如果我完全删除了node_modules文件夹并再次运行npm install,那么一切正常。
NPM INSTALL
gulp minify-sdk && gulp setup-auto
module.js:339
throw err;
^
Error: Cannot find module 'gulp-util'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/simon/latest/node_modules/.bin/gulp:4:13)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! app@0.0.1 postinstall: `gulp minify-sdk && gulp setup-auto`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@0.0.1 postinstall script 'gulp minify-sdk && gulp setup-auto'.
npm ERR! This is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! gulp minify-sdk && gulp setup-auto
npm ERR! You can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.
NPM START
nodemon app.js
module.js:339
throw err;
^
Error: Cannot find module '../lib/cli'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Users/simon/latest/node_modules/.bin/nodemon:3:11)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
npm ERR! Darwin 15.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.1
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! app@0.0.1 start: `nodemon app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app@0.0.1 start script 'nodemon app.js'.
npm ERR! This is most likely a problem with the app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.
为什么node_module文件夹以某种方式被破坏或配置错误的任何想法?