lostintranslation lostintranslation - 5 months ago 82
Node.js Question

npm install not pulling in devDependencies

I have npm v 1.2.32

When I run:
$npm install mongo-migrate

it does not install mongodb which is a devDependency.

What am I doing wrong?

Answer

When you install a package from the NPM repository, dev dependencies won't automatically be installed as well (because those dependencies shouldn't be necessary to get the main package working properly).

You need to explicitly instruct npm to install dev dependencies too:

npm install mongo-migrate --dev

Update

The --dev command has been deprecated.

npm WARN install Usage of the --dev option is deprecated. Use --only=dev instead.

npm install mongo-migrate --only=dev