[BUG] `npm install` ignores `--production=false` (7.7.0)
Current Behavior:
NODE_ENV=production npm install --production=false doesn't install project's devDependecies.
Expected Behavior:
NODE_ENV=production npm install --production=false installs devDependencies according to docs:
To install all modules listed in both
dependenciesanddevDependencieswhenNODE_ENVenvironment variable is set toproduction, you can use--production=false.
Steps To Reproduce:
NODE_ENV=production npm install --production=false- dev dependencies are missing (
npm lsprintsUNMET DEPENDENCYfor them)
Environment:
- OS: MacOS BigSur 11.2.1
- Node: 14.15.1
- npm: 7.7.0
We had this problem on Heroku today.
I think that the change is for the better, NODE_ENV=production should not install devDependencies.
Our quick-fix is to force installation of devDependencies on heroku via "heroku-postbuild": "npm install --include=dev && make prod" in package.json.
This is a change from 7.6.x and should probably not have been released before 8.0, since it broke our deployment flow half a day, meaning no updates to our website.
This should be fixed in v7.7.2
Thank you, but I'm still able to reproduce the issue with 7.7.2 and 7.7.3.
Yep sorry about that. New PR is up and should fix it, and I screenshotted this exact scenario to show it really does fix it this time.
In the short interim before this fix goes out I'd like to point out to folks that --production is deprecated, in favor of passing explicit --include and --omit values. (This was very recently deprecated, this is likely the first you're hearing about it).
So if you wanted to override NODE_ENV=production in a non-deprecated way you would use --include=dev.
landed in [email protected] 🙏 please let us know if you still have any problems.