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

fix: don't go into global mode if aliased to npmg #7842

Merged
merged 1 commit into from
Oct 17, 2024
Merged

Conversation

wraithgar
Copy link
Member

BREAKING CHANGE: npm will no longer switch to global mode if aliased to "npmg" or "npm-g" etc.

This code 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.

BREAKING CHANGE: npm will no longer switch to global mode if aliased to "npmg" or "npm-g" etc.
@wraithgar wraithgar requested a review from a team as a code owner October 16, 2024 17:56
@wraithgar wraithgar merged commit ecd2d23 into latest Oct 17, 2024
19 checks passed
@wraithgar wraithgar deleted the gar/npmg branch October 17, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants