Skip to content

[BUG] npm install does not include pre-release when determining version to install #7851

Open
@johnwc

Description

@johnwc

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

When installing via npm install our-library@">4.2.0-beta", npm does not find any version to install. It ignores any pre-release version unless you specify the exact pre-release version. Same with npm outdated, it does show that there is a new pre-release version available in the Latest column, but Wanted column is always current installed pre-release version. I have tried using >4.2.0-beta, ^4.2.0-beta, and ~4.2.0-beta. None will cause the outdated to show the new pre-release as wanted.

Expected Behavior

With the use of >4.2.0-beta, outdated and install should consider pre-release versions. Or add a command line switch to enable looking for pre-release versions.

Steps To Reproduce

Installing

  1. Build library that has pre-release version 1.0.1-beta-123 and publish it to npm repo.
  2. Try to install using >1.0.0-beta

Updating

  1. Build library that has pre-release version 1.0.1-beta-123 and publish it to npm repo.
  2. Install using @^1.0.1-beta-123
  3. Build new pre-release version 1.0.2-beta-456 and publish it to npm repo.
  4. Run npm outdated. Wanted shows 1.0.1-beta-123, Latest shows 1.0.2-beta-456

Environment

  • npm: 10.9.0
  • Node.js: v21.7.3
  • OS Name: Windows 11
  • npm config:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next steps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions