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

[BUG] npm install ignores --production=false (7.7.0) #2936

Closed
Audio opened this issue Mar 24, 2021 · 6 comments · Fixed by #2942
Closed

[BUG] npm install ignores --production=false (7.7.0) #2936

Audio opened this issue Mar 24, 2021 · 6 comments · Fixed by #2942
Assignees
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 7.x work is associated with a specific npm 7 release

Comments

@Audio
Copy link

Audio commented Mar 24, 2021

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 dependencies and devDependencies when NODE_ENV environment variable is set to production, you can use --production=false.

Steps To Reproduce:

  1. NODE_ENV=production npm install --production=false
  2. dev dependencies are missing (npm ls prints UNMET DEPENDENCY for them)

Environment:

  • OS: MacOS BigSur 11.2.1
  • Node: 14.15.1
  • npm: 7.7.0
@Audio Audio added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 24, 2021
@dotnetCarpenter
Copy link

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.

@ruyadorno ruyadorno added Priority 0 will get attention right away and removed Needs Triage needs review for next steps labels Mar 24, 2021
@wraithgar wraithgar self-assigned this Mar 24, 2021
isaacs added a commit that referenced this issue Mar 24, 2021
This consolidates all the various --include and --omit configuration
flatteners into a single function, since they have to be interdependent
in order to function properly.

Fix: #2936
@wraithgar
Copy link
Member

This should be fixed in v7.7.2

@Audio
Copy link
Author

Audio commented Mar 24, 2021

Thank you, but I'm still able to reproduce the issue with 7.7.2 and 7.7.3.

@wraithgar
Copy link
Member

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.

@wraithgar
Copy link
Member

wraithgar commented Mar 24, 2021

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.

@ruyadorno
Copy link
Contributor

landed in npm@7.7.4 🙏 please let us know if you still have any problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants