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

Peer dependency issue when when creating a new app #126

Closed
brandonleichty opened this issue Jul 19, 2022 · 8 comments
Closed

Peer dependency issue when when creating a new app #126

brandonleichty opened this issue Jul 19, 2022 · 8 comments

Comments

@brandonleichty
Copy link

brandonleichty commented Jul 19, 2022

When running npm init vue@latest or npm init vue@3and then runningnpm install` I'm running into the following peer dependency issues:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/vue
npm ERR!   vue@"^3.2.37" from the root project
npm ERR!   peer vue@"^2.6.14 || ^3.2.0" from [email protected]
npm ERR!   node_modules/pinia
npm ERR!     pinia@"^2.0.16" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@">= 2.5 < 2.7" from @vue/[email protected]
npm ERR! node_modules/@vue/composition-api
npm ERR!   peer @vue/composition-api@"^1.4.0" from [email protected]
npm ERR!   node_modules/pinia
npm ERR!     pinia@"^2.0.16" 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/brandonleichty/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brandonleichty/.npm/_logs/2022-07-19T03_35_06_918Z-debug-0.log

And here is my project setup selection:

Screen Shot 2022-07-18 at 8 37 23 PM

Node: 16.16.0
MacOS: 12.3 (Apple Silicon)

@haoqunjiang
Copy link
Member

Can't reproduce it on my machine. Maybe it's caused by something in the parent folder? Something in test-2 that interferes with the dependency resolution?
Does this also happen when you create the project in other paths too?

@brandonleichty
Copy link
Author

@sodatea thank you for trying to reproduce. I also tried it it directly on my desktop and ran into the same error (I've tried a few different directories):

Screen Shot 2022-07-18 at 10 39 04 PM

@brandonleichty
Copy link
Author

Also tried:

  1. Restarting my computer
  2. Different terminals
  3. Updating Node

@haoqunjiang
Copy link
Member

What's your npm version? This is super weird. Because @vue/composition-api is an optional peer dependency of pinia. There's no reason for it to crash npm.
https://github.com/vuejs/pinia/blob/b6382452030a3b006c5bf61302e699f19d4d88e5/packages/pinia/package.json#L89-L91

@brandonleichty
Copy link
Author

NPM version is 8.11.0

Screen Shot 2022-07-18 at 10 54 13 PM

@brandonleichty
Copy link
Author

And here is the error report:

# npm resolution error report

2022-07-19T05:53:29.578Z

While resolving: [email protected]
Found: [email protected]
node_modules/vue
  vue@"^3.2.37" from the root project
  peer vue@"^2.6.14 || ^3.2.0" from [email protected]
  node_modules/pinia
    pinia@"^2.0.16" from the root project

Could not resolve dependency:
peer vue@">= 2.5 < 2.7" from @vue/[email protected]
node_modules/@vue/composition-api
  peer @vue/composition-api@"^1.4.0" from [email protected]
  node_modules/pinia
    pinia@"^2.0.16" 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": "vue",
    "version": "3.2.37",
    "whileInstalling": {
      "name": "test-vue-app-2",
      "version": "0.0.0",
      "path": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
    },
    "location": "node_modules/vue",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "prod",
        "name": "vue",
        "spec": "^3.2.37",
        "from": {
          "location": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
        }
      },
      {
        "type": "peer",
        "name": "vue",
        "spec": "^2.6.14 || ^3.2.0",
        "from": {
          "name": "pinia",
          "version": "2.0.16",
          "whileInstalling": {
            "name": "test-vue-app-2",
            "version": "0.0.0",
            "path": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
          },
          "location": "node_modules/pinia",
          "isWorkspace": false,
          "dependents": [
            {
              "type": "prod",
              "name": "pinia",
              "spec": "^2.0.16",
              "from": {
                "location": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
              }
            }
          ]
        }
      }
    ]
  },
  "currentEdge": {
    "type": "prod",
    "name": "vue",
    "spec": "^3.2.37",
    "from": {
      "location": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
    }
  },
  "edge": {
    "type": "peer",
    "name": "vue",
    "spec": ">= 2.5 < 2.7",
    "error": "INVALID",
    "from": {
      "name": "@vue/composition-api",
      "version": "1.7.0",
      "whileInstalling": {
        "name": "test-vue-app-2",
        "version": "0.0.0",
        "path": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
      },
      "location": "node_modules/@vue/composition-api",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "peer",
          "name": "@vue/composition-api",
          "spec": "^1.4.0",
          "from": {
            "name": "pinia",
            "version": "2.0.16",
            "whileInstalling": {
              "name": "test-vue-app-2",
              "version": "0.0.0",
              "path": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
            },
            "location": "node_modules/pinia",
            "isWorkspace": false,
            "dependents": [
              {
                "type": "prod",
                "name": "pinia",
                "spec": "^2.0.16",
                "from": {
                  "location": "/Users/brandonleichty/Desktop/test-vue-app/test-vue-app-2"
                }
              }
            ]
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

@haoqunjiang
Copy link
Member

For now, you can use npm install --legacy-peer-deps to temporarily work around this issue.
It's also tracked in the pinia repo as vuejs/pinia#853

I think it could be an npm bug: npm/cli#4859
But it's a little confusing that I cannot reproduce the issue myself…

@brandonleichty
Copy link
Author

@sodatea I wanted to follow-up on this one incase anyone else runs into this issue. I discovered that the issue was caused by company's internal NPM registry. I removed the registry from the NPM config file, and it solved the issue.

Thanks!

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

No branches or pull requests

2 participants