I’m facing a strange problem on my Windows computer. When I run npm install, it seems to only install the main dependencies and completely overlooks the devDependencies. I was under the impression that npm install would automatically install both types.
Interestingly, when I use npm install --dev, all the devDependencies are installed without any issues. Shouldn’t the standard npm install command take care of both installations?
I’m starting to think there might be something wrong with my package.json or a misconfiguration somewhere. Here’s what my package.json looks like:
Had the same issue! It’s probably your NODE_ENV environment variable. Check if it’s set to ‘production’ in your system environment or any .env files. When NODE_ENV is ‘production’, npm install automatically skips devDependencies even without --production flag. Super common gotcha. Run echo $NODE_ENV (or echo %NODE_ENV% on Windows) to check. If it shows ‘production’, that’s your problem. Just unset it or change it to ‘development’ and npm install should work normally again.
This happens when npm thinks you’re in production mode. Check your npm config beyond just NODE_ENV - run npm config list and look for anything forcing production or disabling dev dependencies. Also check for a .npmrc file in your project root or home directory that might have production=true or similar. I ran into this once when a deployment script changed my global npm config and it stuck around for other projects. Your package.json looks fine, so it’s definitely a config issue, not a structural problem.
Check if you ran npm install --production or have --omit=dev in your config. Windows caches these flags sometimes. Clear your npm cache with npm cache clean --force, delete node_modules completely, then run npm install again. Fixed it for me when this happened.
You might’ve run npm ci recently instead of npm install. The npm ci command follows the lockfile exactly and can mess with your local npm setup - making it act like production mode. I’ve hit this exact issue after deploying where npm ci was used, then regular npm install commands started skipping devDependencies. Delete both node_modules and package-lock.json, then run npm install from scratch. This forces npm to rebuild everything fresh and usually fixes whatever config conflicts are causing the weird installation behavior.
This npm weirdness happens when you switch environments or juggle multiple projects. I’ve watched it destroy entire deployment pipelines.
Sure, you can check NODE_ENV and npm config manually, but that’s the real problem - doing it manually every single time. I just automated the whole thing with Latenode.
My workflow watches package.json changes and runs the right npm commands based on environment. It checks config variables, cleans production flags, and handles the install sequence automatically.
It also validates dependencies actually installed correctly and pings me if something breaks. No more npm config debugging or wondering why dev tools won’t work.
Saves me hours weekly across projects. Beats checking environment variables every time stuff breaks.
Windows does this weird thing where npm commands get cached with their flags in the command prompt history. I ran into this same issue after a build script used npm install --only=production internally. Even closing the terminal didn’t help because Windows kept remembering the production flag somehow. Here’s what worked: open a fresh command prompt as admin and run npm config delete production, then npm install. Also check if you’ve got any global .npmrc files in your user directory that might be setting production flags. Your package.json looks fine, so this is definitely an environment config issue, not syntax.