Solucione el conflicto de dependencia ascendente instalando paquetes NPM

2 minutos de lectura

Intento instalar npm vue-mapbox mapbox-gl y obtengo un error de árbol de dependencia.

Estoy ejecutando Nuxt SSR con Vuetify y no he instalado nada relacionado con Mapbox antes de ejecutar esta instalación y obtener este error.

38 código de error ERESOLVE 39 error ERESOLVE no pudo resolver el árbol de dependencia 40 error 41 error Al resolver: [1mexample[22m@[1m1.0.0[22m
41 error Found: [1mmapbox-gl[22m@[1m1.13.0[22m[2m[22m
41 error [2mnode_modules/mapbox-gl[22m
41 error   [1mmapbox-gl[22m@"[1m^1.13.0[22m" from the root project
41 error
41 error Could not resolve dependency:
41 error [35mpeer[39m [1mmapbox-gl[22m@"[1m^0.53.0[22m" from [1mvue-mapbox[22m@[1m0.4.1[22m[2m[22m
41 error [2mnode_modules/vue-mapbox[22m
41 error   [1mvue-mapbox[22m@"[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 npm@latest 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 npm@latest
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

¿Ha sido útil esta solución?

Esta web utiliza cookies propias y de terceros para su correcto funcionamiento y para fines analíticos y para mostrarte publicidad relacionada con sus preferencias en base a un perfil elaborado a partir de tus hábitos de navegación. Al hacer clic en el botón Aceptar, acepta el uso de estas tecnologías y el procesamiento de tus datos para estos propósitos. Configurar y más información
Privacidad