On windows for some reason when I run npm install
it won't install devDependencies. AFAIK it should. If I run npm install --dev
devDependencies are installed. I don't understand why npm install
doesn't install devDependencies too, but installs only dependencies. What could be the reason? How can I fix it?
Maybe smth is wrong with my package.json? It is listed below if it may be helpful
{
"name": "try-brunch",
"version": "0.1.0",
"private": "true",
"devDependencies": {
"brunch": "^2.0.4",
"cssnano-brunch": "^1.1.5",
"javascript-brunch": "^1.8.0",
"sass-brunch": "^1.9.2",
"uglify-js-brunch": "^1.7.8"
},
"dependencies": {
"jquery": "^2.1.4"
}
}
make sure you don't have env variable
NODE_ENV
set to 'production'.If you do, dev dependencies will not be installed without the
--dev
flagI had a
package-lock.json
file from an old version of my package.json, I deleted that and then everything installed correctly.I had a similar problem.
npm install --only=dev
didn't work, and neither didnpm rebuild
. Ultimately, I had to deletenode_modules
andpackage-lock.json
and runnpm install
again. That fixed it for me.Check the NPM docs for install
Have you tried
If you are worried that your package.json might be incorrect, best thing to do is this. Create a new folder, and run:
Then:
And you should be good to go! Otherwise, will keep posting other options.
Check your npm configuration:
npm gets its config settings from the command line, environment variables, and npmrc files. So check environment variables, and the npmrc file.
Still failing?
Ok, create a new folder, ideally somewhere else on your filesystem. ie. not in same folder hierarchy. For instance, C:\myNewFolder - the closer to the base C: drive the better.
Then run:
Now run:
and finally:
Does everything work as expected?
What I am trying to do is understand whether your problem is global, or something local to the previous folder and dependencies.
Check if npm config production value is set to true. If this value is true, it will skip over the dev dependencies.
Run
npm config get production
To set it:
npm config set -g production false
Make sure your
package.json
is valid...I had the following error...
npm WARN Invalid name: "blah blah blah"
and that, similarly, caused
devDependencies
not to be installed.FYI, changing the
package.json
"name" toblah-blah-blah
fixed it.