Tuesday, 2 June 2015

node npm dependencies

Usually when you run npm install locally, it will install all packages of your package.json file, including "dependencies" and "devDependencies".

npm offers "dependencies" and "devDependencies" for purpose. Actually npm also offers "optionalDependencies".  (the only different of optional and other dependencies is that build failures do not cause installation to fail)

 "devDependencies"  is for local testing and running, so you can put your unit test packages and e2e test packages here.

"dependencies" is for production, so you should not put test packages here.

When your run npm install locally, it will install all packages includes "dependencies" and "devDependencies".

But in some server like heroku, they install "devDependencies" packages only (https://devcenter.heroku.com/articles/nodejs-support). That managed by npm model.

You can change that by changing system ENV:  NODE_ENV="production"
or just run npm like this: npm install --production



No comments:

Post a comment