Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Conflicting peer dependency quando instalo os pacotes do eslint

Olá, decidi usar o projeto do curso anterior (ao invés de só baixar o novo). Quando tento instalar as dependências do ESLint, surge o seguinte erro:

fernandomedeirosdonascimento@MBP-de-Fernando aluroni % npm init @eslint/config
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · prompt
✔ What format do you want your config file to be in? · JSON
✔ What style of indentation do you use? · 4
✔ What quotes do you use for strings? · single
✔ What line endings do you use? · unix
✔ Do you require semicolons? · No / Yes
Local ESLint installation not found.
The config that you've selected requires the following dependencies:

@typescript-eslint/eslint-plugin@latest eslint-plugin-react@latest @typescript-eslint/parser@latest eslint@latest
✔ Would you like to install them now? · No / Yes
✔ Which package manager do you want to use? · npm
Installing @typescript-eslint/eslint-plugin@latest, eslint-plugin-react@latest, @typescript-eslint/parser@latest, eslint@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: aluroni@0.1.0
npm ERR! Found: @typescript-eslint/eslint-plugin@5.62.0
npm ERR! node_modules/@typescript-eslint/eslint-plugin
npm ERR!   @typescript-eslint/eslint-plugin@"^5.5.0" from eslint-config-react-app@7.0.1
npm ERR!   node_modules/eslint-config-react-app
npm ERR!     eslint-config-react-app@"^7.0.1" from react-scripts@5.0.1
npm ERR!     node_modules/react-scripts
npm ERR!       react-scripts@"5.0.1" from the root project
npm ERR!   peerOptional @typescript-eslint/eslint-plugin@"^4.0.0 || ^5.0.0" from eslint-plugin-jest@25.7.0
npm ERR!   node_modules/eslint-plugin-jest
npm ERR!     eslint-plugin-jest@"^25.3.0" from eslint-config-react-app@7.0.1
npm ERR!     node_modules/eslint-config-react-app
npm ERR!       eslint-config-react-app@"^7.0.1" from react-scripts@5.0.1
npm ERR!       node_modules/react-scripts
npm ERR!         react-scripts@"5.0.1" from the root project
npm ERR!   1 more (the root project)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! dev @typescript-eslint/eslint-plugin@"6.13.1" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @typescript-eslint/parser@6.13.1
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^6.0.0 || ^6.0.0-alpha" from @typescript-eslint/eslint-plugin@6.13.1
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     dev @typescript-eslint/eslint-plugin@"6.13.1" 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! 
npm ERR! For a full report see:
npm ERR! /Users/fernandomedeirosdonascimento/.npm/_logs/2023-11-28T20_39_16_801Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: /Users/fernandomedeirosdonascimento/.npm/_logs/2023-11-28T20_39_16_801Z-debug-0.log
Successfully created .eslintrc.json file in /Users/fernandomedeirosdonascimento/code/estudos/react/aluroni

Ou seja, ele cria o json do lint, mas dá erro na instalação de pacotes. Alguém sabe como resolver?

3 respostas
solução!

Bom, na verdade a solução foi simples. Apagar /node_modules e package-lock.json e instalar o lint de novo. Fica a dica ai.

Obrigadooo! Eu tive o mesmo problema e a sua solução resolveu!

Fernando arrasoooou, tive o mesmo erro, arrumei com a sua dica, obrigada!!!