Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npm install --production to install only dependencies #15

Closed
theomega opened this issue Mar 9, 2016 · 2 comments
Closed

Use npm install --production to install only dependencies #15

theomega opened this issue Mar 9, 2016 · 2 comments

Comments

@theomega
Copy link
Contributor

theomega commented Mar 9, 2016

Per default, npm install also installs the devDependencies. If you don't want to have these dependencies, you need to add the --production switch.

The documentation explains this switch:

By default, npm install will install all modules listed as dependencies in package.json.

With the --production flag (or when the NODE_ENV environment variable is set to production), npm will not install modules listed in devDependencies.

For the differences between the dependencies and the dev dependencies see the explanation of package.json:

dependencies
Please do not put test harnesses or transpilers in your dependencies object. See devDependencies, below.

devDependencies
If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.
In this case, it's best to map these additional items in a devDependencies object.
These things will be installed when doing npm link or npm install from the root of a package, and can be managed like any other npm configuration param. See npm-config for more on the topic.
For build steps that are not platform-specific, such as compiling CoffeeScript or other languages to JavaScript, use the prepublish script to do this, and make the required package a devDependency.

@heartsucker
Copy link
Owner

@theomega Ha. Thanks. Not actually knowing anything about node/npm is biting my ass a bit. Expect a fix soon.

@heartsucker
Copy link
Owner

Fixed with 9dade95

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants