Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ERESOLVE peer dep conflict reported when no conflict exists #3138

Closed
ljharb opened this issue Apr 23, 2021 · 5 comments
Closed

[BUG] ERESOLVE peer dep conflict reported when no conflict exists #3138

ljharb opened this issue Apr 23, 2021 · 5 comments
Assignees
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release

Comments

@ljharb
Copy link
Contributor

ljharb commented Apr 23, 2021

Current Behavior:

in eslint-plugin-react's repo, on master, i ran npx npm@7 install --save-dev @types/eslint @types/node eslint-plugin-eslint-plugin@3 semver sinon typescript typescript-eslint-parser.

I got https://gist.github.com/ljharb/dc643e6f094d5dfc912633a5e55637ab as output. Note:

npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^7.0.0" from [email protected]

Expected Behavior:

It should have installed and saved these dev deps. ^7.0.0 is compatible with v7.24.0.

Steps To Reproduce:

Clone the repo, run npm install, then run the above command.

Environment:

  • OS: Mac
  • Node: 15.14.0
  • npm: 7.11.0 and v7.10.0

(this does _ not_ appear to be the same issue as #3113 or #2823)

@ljharb ljharb added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Apr 23, 2021
@darcyclarke
Copy link
Contributor

@ljharb can you reproduce on latest? (ie. 7.17.0) I know we've made numerous changes/bug fixes since 7.10.0

@darcyclarke darcyclarke removed the Needs Triage needs review for next steps label Jun 11, 2021
@ljharb
Copy link
Contributor Author

ljharb commented Jun 12, 2021

@darcyclarke yes, i can reproduce it on latest npm:

code ERESOLVE
ERESOLVE unable to resolve dependency tree

Found: [email protected]
node_modules/eslint-plugin-eslint-plugin
  dev eslint-plugin-eslint-plugin@"3" from the root project

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"3" from the root project

Conflicting peer dependency: [email protected]
node_modules/eslint
  peer eslint@"^7.0.0" from [email protected]
  node_modules/eslint-plugin-eslint-plugin
    dev eslint-plugin-eslint-plugin@"3" from the root project
`eresolve-report.txt`:
# npm resolution error report

2021-06-12T07:00:59.767Z

Found: [email protected]
node_modules/eslint-plugin-eslint-plugin
  dev eslint-plugin-eslint-plugin@"3" from the root project

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"3" from the root project

Conflicting peer dependency: [email protected]
node_modules/eslint
  peer eslint@"^7.0.0" from [email protected]
  node_modules/eslint-plugin-eslint-plugin
    dev eslint-plugin-eslint-plugin@"3" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "eslint-plugin-eslint-plugin",
    "version": "2.3.0",
    "location": "node_modules/eslint-plugin-eslint-plugin",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "eslint-plugin-eslint-plugin",
        "spec": "3",
        "error": "INVALID",
        "from": {
          "location": "$PWD"
        }
      }
    ]
  },
  "currentEdge": null,
  "edge": {
    "type": "dev",
    "name": "eslint-plugin-eslint-plugin",
    "spec": "3",
    "error": "INVALID",
    "from": {
      "location": "$PWD"
    }
  },
  "peerConflict": {
    "name": "eslint",
    "version": "7.28.0",
    "whileInstalling": {
      "name": "eslint-plugin-react",
      "version": "7.24.0",
      "path": "$PWD"
    },
    "location": "node_modules/eslint",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "peer",
        "name": "eslint",
        "spec": "^7.0.0",
        "from": {
          "name": "eslint-plugin-eslint-plugin",
          "version": "3.0.3",
          "whileInstalling": {
            "name": "eslint-plugin-react",
            "version": "7.24.0",
            "path": "$PWD"
          },
          "location": "node_modules/eslint-plugin-eslint-plugin",
          "isWorkspace": false,
          "dependents": [
            {
              "type": "dev",
              "name": "eslint-plugin-eslint-plugin",
              "spec": "3",
              "from": {
                "location": "$PWD"
              }
            }
          ]
        }
      }
    ]
  },
  "strictPeerDeps": false,
  "force": false
}

@isaacs
Copy link
Contributor

isaacs commented Jul 27, 2021

This is a reporting error.

$ npm view @typescript-eslint/parser@"^2.34.0" peerDependencies
{ eslint: '^5.0.0 || ^6.0.0' }

$ npm view eslint-plugin-eslint-plugin@3 peerDependencies
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }
[email protected] { eslint: '^7.0.0' }

You're trying to use @typescript-eslint/parser@"^2.34.0" alongside eslint-plugin-eslint-plugin@3, but these two have incompatible peer deps.

So the ERESOLVE is the correct outcome, but the reporting here leaves much to be desired.

I'm in the midst of upgrading the cli to @npmcli/[email protected], and the report got even more broken. 😅 So I'm going to dig into that now.

@isaacs
Copy link
Contributor

isaacs commented Jul 27, 2021

Ok, the error was easy to work around. Caused by the ERESOLVE explanations getting a bit more useful in arborist 2.8, ironically enough, but no longer squishing a direct conflict in with the extended peerDep conflict, which was losing some information.

Fixed report looks like this, and I'm going to call this a by-design crash, with a reporting error that'll be fixed on the next release:

$ npm i --save-dev @types/eslint @types/node eslint-plugin-eslint-plugin@3 semver sinon typescript typescript-eslint-parser
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
npm ERR!   peer eslint@"^5.0.0 || ^6.0.0" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/parser
npm ERR!     dev @typescript-eslint/parser@"^2.34.0" from the root project
npm ERR!   2 more (eslint-config-airbnb-base, eslint-plugin-import)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-plugin-eslint-plugin@"3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/eslint
npm ERR!   peer eslint@"^7.0.0" from [email protected]
npm ERR!   node_modules/eslint-plugin-eslint-plugin
npm ERR!     dev eslint-plugin-eslint-plugin@"3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/isaacs/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/isaacs/.npm/_logs/2021-07-27T23_10_48_034Z-debug.log

@ljharb
Copy link
Contributor Author

ljharb commented Jul 28, 2021

I see the conflict, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

3 participants