Fluffy Fluffy - 5 months ago 20x
Node.js Question

How to shrinkwrap devDependencies, but not install them unless necessary?

I have a bunch of

needed in order to run test suite and have production dependencies locked down with
npm shrinkwrap
. The problem is that when I run
npm install
, only production dependencies are installed, in order to install
, I have to remove npm-shrinkwrap.json and run it again. Now if shrinkwrap contains devDependencies as well, they get installed in production, where they are not required. Surely there should be some command line arguments to force only normal dependencies to be installed?


As stated in the NPM docs:

Since npm shrinkwrap is intended to lock down your dependencies for production use, devDependencies will not be included unless you explicitly set the --dev flag when you run npm shrinkwrap. If installed devDependencies are excluded, then npm will print a warning. If you want them to be installed with your module by default, please consider adding them to dependencies instead.

Basically, or you lock down all deps, or only the production deps.

Not even running npm install --dev or npm install --force can transcend the shrinkwrap functionality.