0

I just started working on a new project with React 17, then just a week ago React 18 was launched so I upgraded my project to React 18 after I went through their documentation, everything was going fine until I changed my laptop, I cloned the project from GitHub to my other laptop, and when I tried to "NPM install" it kept giving me NPM dependency error, although it worked fine after I put "--legacy-deep-peers", but now when ever I have to install a dependency I have to use the "--legacy-dep-peers" with it or it keeps giving me the same error, is there a workaround with this or I have to keep using this keyword with all of my new dependencies.

The Error Snippet

https://i.stack.imgur.com/BfKJU.png

My Package.json Dependencies

"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.26.0",
"bootstrap": "^5.1.3",
"framer-motion": "^6.2.9",
"hamburger-react": "^2.5.0",
"js-cookie": "^3.0.1",
"nanoid": "^3.3.1",
"prop-types": "^15.8.1",
"react": "^18.0.0",
"react-bootstrap": "^2.2.0",
"react-datepicker": "^4.7.0",
"react-dnd": "^16.0.0",
"react-dnd-html5-backend": "^16.0.0",
"react-dom": "^18.0.0",
"react-hook-form": "^7.29.0",
"react-icons": "^4.3.1",
"react-multi-carousel": "^2.8.0",
"react-redux": "^7.2.8",
"react-router": "^6.2.2",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"react-tag-input": "^6.8.0",
"react-toastify": "^8.2.0",
"redux": "^4.1.2",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.4.1",
"web-vitals": "^2.1.4"}
  • 1
    Until those packages update their peer-dependencies [install-legacy-peer-deps](https://stackoverflow.com/questions/66239691/what-does-npm-install-legacy-peer-deps-do-exactly-when-is-it-recommended-wh) is the workaround. – Andy Apr 08 '22 at 16:12
  • 1
    And a PS: 18 is a massive breaking change release, and the React team admit this. But they've also only tested on code they've written in-house. IMO I would probably wait at least six-months until things have quietened down a little. I'd go back to 17 to ensure code works for a while, and everyone can get up to speed. – Andy Apr 08 '22 at 16:31
  • 1
    @Andy thanks, and yah you're right its probably better to wait a while until things get settled down and third-party package owners catch up with the new release. – Shoaib Arif Apr 08 '22 at 16:51

0 Answers0