Skip to content

[BUG] install order affects correctness of peerDependencies resolution #8492

@falsyvalues

Description

@falsyvalues

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

Peer dependencies written to package.json:

"ag-grid-community": "^34.1.1",
"ag-grid-enterprise": "^34.1.1",
"ag-grid-react": "^34.1.1"

versions resolved in package-lock.json:

"node_modules/ag-grid-community": {
  "version": "34.1.1",
},
"node_modules/ag-grid-enterprise": {
  "version": "34.1.1",
},
"node_modules/ag-grid-react": {
  "version": "34.1.1",
}

Expected Behavior

Peer dependencies written to package.json:

"ag-grid-community": "^34.0.2",
"ag-grid-enterprise": "^34.0.2",
"ag-grid-react": "^34.0.2"

versions resolved in package-lock.json:

"node_modules/ag-grid-community": {
  "version": "34.0.2",
},
"node_modules/ag-grid-enterprise": {
  "version": "34.0.2",
},
"node_modules/ag-grid-react": {
  "version": "34.0.2",
}

Steps To Reproduce

  1. Having package like below, lets call it tab
{
  "name": "tab",
  "peerDependencies": {
    "ag-grid-community": "~34.0.2",
    "ag-grid-enterprise": "~34.0.2",
    "ag-grid-react": "~34.0.2",
  }
}
  1. In host app project, we would like to install tab, and required peerDependencies and more
  2. Run npm install tab random-package ag-grid-community ag-grid-enterprise ag-grid-react --save
  3. See invalid packages being installed (see Current Behavior)

Console output:

npm warn Unknown project config "email". This will stop working in the next major version of npm.
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: [email protected]
npm warn Found: [email protected]
npm warn node_modules/ag-grid-community
npm warn   ag-grid-community@"*" from the root project
npm warn   3 more (tab, ag-grid-enterprise, ag-grid-react)
npm warn
npm warn Could not resolve dependency:
npm warn peer ag-grid-community@"~34.0.2" from [email protected]
npm warn node_modules/tab
npm warn   tab@"*" from the root project
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: [email protected]
npm warn Found: [email protected]
npm warn node_modules/ag-grid-enterprise
npm warn   ag-grid-enterprise@"*" from the root project
npm warn   1 more (tab)
npm warn
npm warn Could not resolve dependency:
npm warn peer ag-grid-enterprise@"~34.0.2" from [email protected]
npm warn node_modules/tab
npm warn   tab@"*" from the root project
npm warn ERESOLVE overriding peer dependency
npm warn While resolving: [email protected]
npm warn Found: [email protected]
npm warn node_modules/ag-grid-react
npm warn   ag-grid-react@"*" from the root project
npm warn   1 more (tab)
npm warn
npm warn Could not resolve dependency:
npm warn peer ag-grid-react@"~34.0.2" from [email protected]
npm warn node_modules/tab
npm warn   tab@"*" from the root project
  1. Now, clear package.json, remove package-lock.json and remove node_modules
  2. Run, note order changed, tab is next to ag-grid-* npm install tab ag-grid-community ag-grid-enterprise ag-grid-react random-package --save
  3. Get expected result 🙏 (see Expected Behavior)

Console output:

npm warn Unknown project config "email". This will stop working in the next major version of npm.

Environment

  • npm: 11.5.2
  • Node.js: v22.18.0
  • OS Name: macOS 15.6
  • System Model Name: MacBook Pro 14-inch, Nov 2023
  • npm config:
; copy and paste output from `npm config ls` here

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