I have this in my package.json file (shortened version):
{
"name": "a-module",
"version": "0.0.1",
"dependencies": {
"coffee-script": ">= 1.1.3"
},
"devDependencies": {
"stylus": ">= 0.17.0"
}
}
I am using NPM version 1.1.1 on Mac 10.6.8.
When I run the following command from the project root, it installs both the dependencies and devDependencies:
npm install
I was under the impression that this command installed the devDependencies:
npm install --dev
How do I make it so npm install only installs dependencies (so production environment only gets those modules), while something like npm install --dev installs both dependencies and devDependencies?
The
npm installcommand will install thedevDependenciesalong otherdependencieswhen run inside a package directory, in a development environment (the default).In version 8.x and above use
--omit=devflag to install only regular dependencies:This will install only
dependencies, and notdevDependencies, regardless of the value of theNODE_ENVenvironment variable.If you use 6.x or an earlier version, you need to use the
--only=prodflag instead.Note:
Before v3.3.0 of npm (2015-08-13), the option was called
--production, i.e.You may also need
--no-optionalflag.