You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] npm v7 breaks itself upon installing itself in --global --production mode. #1708
I suppose it was from misremembering the facts you just mentioned. Do global installs not include devDependencies?
(EDIT: You appear to be right. I actually can't get npm 6 to install the devDependencies at all in --global mode, even without --production and running with --also=dev. But that's off-topic for this issue.)
In any case, these "steps to reproduce" do not break existing, stable releases of npm, so I consider it a bug in this beta release, regardless of if the command is a sensible one to run.
For better or for worse, I seem to recall that it's a common thing in various READMEs to tell users to do global package installs with the --production flag.
Update: I sent PRs to Node [1] and node-gyp [2] and they're landed. So users in the future won't have the confusion I did about npm install --global --production being a thing you would want to type.
changed the title [-][BUG] npm@7.0.0-beta breaks itself upon installing itself in `--global --production` mode.[/-][+][BUG] npm v7 breaks itself upon installing itself in `--global --production` mode.[/+]on Oct 20, 2020
Hi @nlf, I am still able to reproduce it with npm 7.0.9 on Node 12 and Node 14, but I mostly cannot reproduce it on Node 15.
Strangely, only once I was able to run the command npm install --global --production npm@7 in Node 14 several times in a row, but this seems to be a fluke. Likewise, I was able to reproduce the issue once on Node 15, but usually I can't on Node 15.
Maybe this is an intermittent issue. And I do think it happens less often on Node 15. I have a mechanical hard drive if that has anything to do with it? (Speculating if it may be a race condition).
Activity
ljharb commentedon Aug 23, 2020
Why would you be installing in production mode explicitly? Dev deps only show up if you run
npm installornpm install --dev.DeeDeeG commentedon Aug 23, 2020
I suppose it was from misremembering the facts you just mentioned. Do global installs not include
devDependencies?(EDIT: You appear to be right. I actually can't get npm 6 to install the
devDependenciesat all in--globalmode, even without--productionand running with--also=dev. But that's off-topic for this issue.)In any case, these "steps to reproduce" do not break existing, stable releases of
npm, so I consider it a bug in this beta release, regardless of if the command is a sensible one to run.DeeDeeG commentedon Aug 23, 2020
For better or for worse, I seem to recall that it's a common thing in various READMEs to tell users to do global package installs with the
--productionflag.For example,
node-gyp'sREADME.md: https://github.com/nodejs/node-gyp/tree/v7.1.0#option-1And Node's documentation page: https://nodejs.org/docs/v14.9.0/api/n-api.html#n_api_building
(Probably copy-pasted from
windows-build-tools' ownREADME.md, which has since been updated: felixrieseberg/windows-build-tools@4420dc8)Update: I sent PRs to Node [1] and node-gyp [2] and they're landed. So users in the future won't have the confusion I did about
npm install --global --productionbeing a thing you would want to type.AKASHGJHKJ commentedon Aug 25, 2020
isaacs commentedon Aug 25, 2020
2 remaining items
[-][BUG] npm@7.0.0-beta breaks itself upon installing itself in `--global --production` mode.[/-][+][BUG] npm v7 breaks itself upon installing itself in `--global --production` mode.[/+]DeeDeeG commentedon Oct 20, 2020
Update: This still applies, tested with stable npm@7.0.3.
If you run
npm install -g --production npm@7twice, you will have a broken npm.nlf commentedon Nov 6, 2020
i'm not able to reproduce this, can you try it with 7.0.9?
DeeDeeG commentedon Nov 6, 2020
Hi @nlf, I am still able to reproduce it with npm 7.0.9 on Node 12 and Node 14, but I mostly cannot reproduce it on Node 15.
Strangely, only once I was able to run the command
npm install --global --production npm@7in Node 14 several times in a row, but this seems to be a fluke. Likewise, I was able to reproduce the issue once on Node 15, but usually I can't on Node 15.Maybe this is an intermittent issue. And I do think it happens less often on Node 15. I have a mechanical hard drive if that has anything to do with it? (Speculating if it may be a race condition).
DeeDeeG commentedon Jan 21, 2021
I think this is fixed now, thanks for working on this @nlf!
I tested, and I could not reproduce the bug on the following Node versions:
Tested on my macBook, macOS 10.15.7 Catalina.