2

I'm setting up Continuous Integration/Continuous Deployment for a NodeJS app and am having some issues with npm install/dependency management.

  • Running the tests locally passes OK.
  • Running CI (with tests) on TravisCI or CodeShip passes OK.

However, when I download the package from Travis or CodeShip, and try to run an npm script e.g. npm install or npm start, I get dependency errors.

If I completely the remove the node_modules folder and run npm install again, everything works OK.

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.

Any ideas why the node_module folder is being corrupted or misconfigured somehow?

Seonixx
  • 468
  • 3
  • 16
  • Looking at the error logs, could be related to this :- http://stackoverflow.com/questions/29323982/error-cannot-find-module-lib-cli. That the problem above is nodemon and gulp are not installed globally and you are getting it to work by freshly installing the dependencies locally. – griffio May 10 '16 at 20:54
  • I just don't accept that the "fix" for this is to rerun npm install. If I'm running npm scripts then I should be able to have every package installed locally. – Seonixx May 11 '16 at 08:28

0 Answers0