0

It is been a while that I am getting an error every time I create a react app.

I tried to remove all node/npm versions and I reinstall a clean one with the latest node LTS, however, I am still getting the below error

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: type-fest@0.21.3
npm ERR! node_modules/type-fest
npm ERR!   type-fest@"^0.21.3" from ansi-escapes@4.3.2
npm ERR!   node_modules/ansi-escapes
npm ERR!     ansi-escapes@"^4.2.1" from @jest/core@26.6.3
npm ERR!     node_modules/@jest/core
npm ERR!       @jest/core@"^26.6.0" from jest@26.6.0
npm ERR!       node_modules/jest
npm ERR!         peer jest@"^26.0.0" from jest-watch-typeahead@0.6.1
npm ERR!         node_modules/jest-watch-typeahead
npm ERR!         1 more (react-scripts)
npm ERR!       1 more (jest-cli)
npm ERR!     ansi-escapes@"^4.3.1" from jest-watch-typeahead@0.6.1
npm ERR!     node_modules/jest-watch-typeahead
npm ERR!       jest-watch-typeahead@"0.6.1" from react-scripts@4.0.3
npm ERR!       node_modules/react-scripts
npm ERR!         react-scripts@"^4.0.3" from the root project
npm ERR!     2 more (jest-watcher, terminal-link)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional type-fest@"^0.13.1" from @pmmmwh/react-refresh-webpack-plugin@0.4.3
npm ERR! node_modules/@pmmmwh/react-refresh-webpack-plugin
npm ERR!   @pmmmwh/react-refresh-webpack-plugin@"0.4.3" from react-scripts@4.0.3
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"^4.0.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/johnnys/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/johnnys/.npm/_logs/2021-07-10T18_33_36_275Z-debug.log
John Yacoub
  • 91
  • 1
  • 8

1 Answers1

1

You are getting the same type of error from a similar post about this issue npm audit fix --force never able to avoid vulnerabilities

There is also a closed ticket in GitHub create-react-app repo. Here is one of the answers:

Hi,

ensure that

your dependencies (including NodeJS/npm/npx/yarn) are up-to-date ensure that CRA is not installed globally Follow https://create-react-app.dev/docs/getting-started/ guide to get started

You need probably keep updating the dependecies to the latest version and wait untill the latest release fix this issue.

Kelei Ren
  • 360
  • 4
  • 10
  • Another solution might be degrading the nodejs version. As @jcapogna mentioned in the GitHub closed ticket, you may try to create react-app with nodejs version 14 instead of the latest version – Kelei Ren Jul 15 '21 at 12:28