1

As the title suggests i am unable to get a typescript project to launch properly and i've tried everything ive found on here.

when i use npm install i get the error message

npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-simple-maps@1.0.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"^17.0.2" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.11.1
npm ERR!   node_modules/@emotion/react
npm ERR!     @emotion/react@"^11.10.5" from the root project
npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.11.0
npm ERR!     node_modules/@emotion/styled
npm ERR!       @emotion/styled@"^11.10.5" from the root project
npm ERR!       4 more (@mui/material, @mui/styled-engine, @mui/system, react-pro-sidebar)
npm ERR!     4 more (@mui/material, @mui/styled-engine, @mui/system, react-pro-sidebar)  
npm ERR!   25 more (@emotion/styled, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from react-simple-maps@1.0.0
npm ERR! node_modules/react-simple-maps
npm ERR!   react-simple-maps@"^1.0.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from react-simple-maps@1.0.0
npm ERR!   node_modules/react-simple-maps
npm ERR!     react-simple-maps@"^1.0.0" 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! C:\Users\theol\AppData\Local\npm-cache\_logs\2023-08-03T23_32_20_104Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\theol\AppData\Local\npm-cache\_logs\2023-08-03T23_32_20_104Z-debug-0.log`

I am able to force it using --legacy-peer-deps however when i open it in browser it gives

enter image description here

any help would be appreciated thanks.

I've tried --force, --legacy-peer-deps, i react-router-dom, npm i @types/react-router-dom non of which fixed the errors im experiencinng

after using npm install --save react@16.14.0 react-dom@16.14.0 to downgrade

pm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @mui/icons-material@5.14.3
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR!   react@"^16.14.0" from the root project
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.11.1
npm ERR!   node_modules/@emotion/react
npm ERR!     @emotion/react@"^11.10.5" from the root project
npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.11.0
npm ERR!     node_modules/@emotion/styled
npm ERR!       @emotion/styled@"^11.10.5" from the root project
npm ERR!       4 more (@mui/material, @mui/system, @mui/styled-engine, react-pro-sidebar)
npm ERR!     4 more (@mui/material, @mui/system, @mui/styled-engine, react-pro-sidebar)
npm ERR!   19 more (@emotion/styled, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! node_modules/@mui/icons-material
npm ERR!   @mui/icons-material@"^5.11.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"^17.0.0 || ^18.0.0" from @mui/icons-material@5.14.3
npm ERR!   node_modules/@mui/icons-material
npm ERR!     @mui/icons-material@"^5.11.0" 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! C:\Users\theol\AppData\Local\npm-cache\_logs\2023-08-04T01_55_04_299Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\theol\AppData\Local\npm-cache\_logs\2023-08-04T01_55_04_299Z-debug-0.log
tiosl
  • 11
  • 3
  • maybe try downgrading react to version 16? – Simon Laux Aug 04 '23 at 01:39
  • @SimonLaux I have tried that now and the outcome is now above – tiosl Aug 04 '23 at 02:00
  • looks like you need to check if there are updates to the dependencies that require the older react version. If not you might need to fork them and update their react version in your fork. – Simon Laux Aug 04 '23 at 02:06
  • @SimonLaux im sorry to ask but how would i do that? – tiosl Aug 04 '23 at 02:13
  • go back to how the project was before you changed it, delete `node_modules`, reinstall with `npm i`. Then read the error to find out what packages expect an older react version. Then search those packages on https://www.npmjs.com to check if there is a newer version of them available, install the newer version if it is available. If not then you try to find the source code of the package, download it, change the peer dependency in their package.json to point to the react version that your project uses. then install the local version of the package in your project: `npm i path/to/cloned/repo` – Simon Laux Aug 04 '23 at 02:27

0 Answers0