Beheben Sie den Upstream-Abhängigkeitskonflikt beim Installieren von NPM-Paketen

Lesezeit: 2 Minuten

Beim Versuch, vue-mapbox mapbox-gl mit npm zu installieren, erhalte ich einen Abhängigkeitsbaumfehler.

Ich verwende Nuxt SSR mit Vuetify und habe nichts installiert, was mit Mapbox zu tun hat, bevor ich diese Installation ausgeführt und diesen Fehler erhalten habe.

38 Fehlercode ERESOLVE 39 Fehler ERESOLVE kann den Abhängigkeitsbaum nicht auflösen 40 Fehler 41 Fehler Beim Auflösen: [1mexample[[email protected][1m1.0.0[22m
41 error Found: [1mmapbox-gl[[email protected][1m1.13.0[22m[2m[22m
41 error [2mnode_modules/mapbox-gl[22m
41 error   [1mmapbox-gl[[email protected]"[1m^1.13.0[22m" from the root project
41 error
41 error Could not resolve dependency:
41 error [35mpeer[39m [1mmapbox-gl[[email protected]"[1m^0.53.0[22m" from [1mvue-mapbox[[email protected][1m0.4.1[22m[2m[22m
41 error [2mnode_modules/vue-mapbox[22m
41 error   [1mvue-mapbox[[email protected]"[1m*[22m" from the root project
41 error
41 error Fix the upstream dependency conflict, or retry
41 error this command with --force, or --legacy-peer-deps
41 error to accept an incorrect (and potentially broken) dependency resolution.
41 error
41 error See /Users/user/.npm/eresolve-report.txt for a full report.
42 verbose exit 1

What’s the right way to go about fixing this upstream dependency conflict?

Looks like it’s a problem with Peer Dependencies in the latest version of npm (v7) which is still a beta version. try with npm install --legacy-peer-deps for detail info check this https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major

  • What is that flag?

    – Ali.Rashidi

    Apr 12, 2021 at 11:02

  • npm: When to use --force and --legacy-peer-deps might be helpful

    – ggorlen

    Apr 28, 2021 at 1:36

user avatar
Shivam Yadav

Use --legacy-peer-deps after npm install. For example, if you want to install radium, use:

npm install --legacy-peer-deps --save radium

user avatar
hatake kakashi

There are TWO ways:

  1. use npm install --legacy-peer-deps to install, and if this doesn’t work use

  2. force method. add –force next to npm install: npm install --force

until npm version 7.19.1 still have same issue, after upgraded to version 7.20.3 use command npm install -g [email protected] and npm audit fix all pkgs fixed without error.

  • delete the package-lock.json file
  • modify the package.json , updating the version as indicated by the peer dependancy
  • run npm install or npm udpate

user avatar
DharmanBot

To Solve Fix the upstream dependency conflict installing NPM packages Error

Method 1. Just Use –legacy-peer-deps after npm install.

For example, if you want to install axios, use

npm install --legacy-peer-deps --save axios.

Method 2. Updating npm and audit fix

npm I -g [email protected]
npm audit fix --force

Method 3. using –force to install packages

npm install axios --force

user avatar
Jakub Kurdziel

You can follow this command

first type:

npm config set legacy-peer-deps true

then type:

npx create-react-app my-app

1010160cookie-checkBeheben Sie den Upstream-Abhängigkeitskonflikt beim Installieren von NPM-Paketen

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy