Skip to content

Conversation

@MaxBlack-dev
Copy link
Contributor

Description

This PR clarifies that the --tag option for npm install only applies to packages specified on the command line, and does not override version ranges in package.json.

Changes

  • Added a note explaining that --tag does not affect dependencies listed in package.json
  • Explained that version ranges in package.json take precedence over the --tag flag
  • Provided an example showing the correct way to install a tagged version: npm install foo@beta

Context

Users were confused when npm install --tag beta didn't install beta-tagged versions of dependencies listed in package.json. The issue reporter discovered that when package.json specifies a version range like "^0.3.0", the --tag flag is ignored and npm installs a version matching the range, even if the beta tag points to a different version (like 0.4.0-beta.1). This was marked as needing better documentation/logging to make the behavior less surprising.

Closes #4685

@MaxBlack-dev MaxBlack-dev requested a review from a team as a code owner November 30, 2025 02:11
@wraithgar wraithgar merged commit ffc9b71 into npm:latest Dec 1, 2025
8 checks passed
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] --tag not overiding package.json version

2 participants