Skip to content

[BUG] npm does not include prerelease versions when matching with peerDependencies #7303

Closed
@pulges

Description

@pulges

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

In a private library I have

"peerDependencies": {
    "my-package": ">=4"
}

and I get "Could not resolve dependency" error when trying to install snapshot versions of library llike

4.3.1-master.1710852533570

The issue has been reported before (#4958) but closed without actually explaining why npm has to diverge from semver specifications and have such undocumented side-effect.

The support for pre-release versions in peerDependencies is really required, when multiple libraries are being developed in conjunction to modularize development environment. Currently solutions to use incorrect "*" as peerDependency criteria or overrides, are very cumbersome to use between multiple developers and can also result in these lines being forgotten and leaking into production code.

Expected Behavior

In peerDependencies conditions should match also prerelease versions.

Steps To Reproduce

No response

Environment

  • npm: 10.5.0
  • Node.js: v20.11.0
  • OS Name: Ubuntu
  • System Model Name: 23.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions