fix: don't go into global mode if aliased to npmg (#7842) · npm/cli@ecd2d23 · GitHub
Skip to content

Commit ecd2d23

Browse files
authored
fix: don't go into global mode if aliased to npmg (#7842)
BREAKING CHANGE: npm will no longer switch to global mode if aliased to "npmg" or "npm-g" etc. [This code](03bd669) is a remnant from when npm defined `bin` entries for itself that included `npm_g` and `npm-g`. npm no longer defines these, and this code should have been removed when those entries were removed. To utilize this today one would have to manually alias npm themselves. What this code does today in practice is make local development very tricky, because if you (like me) use git worktrees, and have a worktree directory that ends in "g", npm will be in global mode when you invoke it as `node .`. This is very "magical" behavior and not at all intuitive. It's best if this just goes away. `npm -g` is explicit and does not require npm trying to guess if you really wanted to be in global mode or not.
1 parent 62c71e5 commit ecd2d23

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

lib/cli/entry.js

Lines changed: 0 additions & 5 deletions

test/lib/cli/entry.js

Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)