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: ignore global prefix if --prefix is used #5291

Merged
merged 1 commit into from Aug 10, 2022
Merged

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Aug 10, 2022

When --prefix is used, both the local and global prefix values are set
to be identical. This is functionally broken because their directory
structures are inherently different (for instance, in posix the tree is
in lib/node_modules in the global prefix).

This commit makes npm exec ignore the global folders if it detects both
local and global prefix are identical.

Closes #5268

When `--prefix` is used, both the local and global prefix values are set
to be identical. This is functionally broken because their directory
structures are inherently different (for instance, in posix the tree is
in `lib/node_modules` in the global prefix).

This commit makes npm exec ignore the global folders if it detects both
local and global prefix are identical.
@wraithgar wraithgar requested a review from a team as a code owner August 10, 2022 14:39
@wraithgar
Copy link
Member Author

before:
Screen Shot 2022-08-10 at 7 40 16 AM

after:
Screen Shot 2022-08-10 at 7 39 31 AM

@npm-cli-bot
Copy link
Collaborator

found 3 benchmarks with statistically significant performance improvements

  • app-large: no-cache
  • app-medium: no-clean, no-clean:audit
timing results
app-large clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
npm@8 39.479 ±1.80 21.124 ±0.25 18.846 ±0.04 21.360 ±1.13 3.219 ±0.00 3.280 ±0.04 2.721 ±0.06 12.578 ±0.06 2.619 ±0.11 3.736 ±0.03
#5291 43.576 ±1.12 20.619 ±0.35 17.459 ±0.40 20.607 ±1.13 3.021 ±0.07 3.091 ±0.04 2.393 ±0.01 12.232 ±0.15 2.517 ±0.00 4.024 ±0.15
app-medium clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
npm@8 29.638 ±0.55 15.593 ±0.08 14.048 ±0.27 14.623 ±1.05 2.947 ±0.01 2.987 ±0.12 2.611 ±0.02 9.406 ±0.02 2.545 ±0.02 3.490 ±0.14
#5291 29.564 ±0.41 15.723 ±0.00 13.616 ±0.09 14.288 ±0.48 2.859 ±0.05 2.952 ±0.18 2.594 ±0.00 8.885 ±0.20 2.285 ±0.06 3.028 ±0.03

Copy link
Contributor

@nlf nlf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a reasonable workaround to me, and the current behavior is absolutely wrong, so 👍

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.

[BUG] regression - npm_config_prefix no longer works with global npx
3 participants