Skip to content

Conversation

@EurFelux
Copy link

@EurFelux EurFelux commented Jan 1, 2026

Summary

  • Global operations (e.g., npm install -g, pnpm add -g, yarn global add) now bypass the project-level packageManager field check
  • This allows users to run global package manager commands even when inside a project configured for a different package manager

Changes

Added isGlobalCommand() function in sources/Engine.ts that detects:

  • npm/pnpm: Any command with -g or --global flag
  • yarn: Commands starting with global (note: yarn global is only available in Yarn 1.x; if a newer version is used, Yarn itself will report an appropriate error)

Test plan

  • Added tests for npm install -g in yarn/pnpm projects
  • Added tests for pnpm add -g in yarn/npm projects
  • Added tests for yarn global add in npm/pnpm projects
  • All existing tests pass

Fixes #690

🤖 Generated with Claude Code

… packageManager

Global operations (e.g., `npm install -g`, `pnpm add -g`, `yarn global add`)
now bypass the project-level `packageManager` field check, since they operate
outside of the project scope.

Fixes nodejs#690

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@EurFelux EurFelux force-pushed the fix/global-commands-transparent branch from 80923a6 to 2c0acf5 Compare January 1, 2026 17: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.

npm global install / uninstall blocked in yarn/pnpm project if npm enabled

1 participant