question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React 17 install problem!

See original GitHub issue

Cannot install in a React 17 project.

package.json:

"dependencies": {
        "axios": "^0.21.1",
        "react": "^17.0.1",
        "react-dom": "^17.0.1",
        "react-redux": "^7.2.2",
        "react-scripts": "^4.0.2",
        "react-router-dom": "^5.2.0",
        "react-helmet-async": "^1.0.7",
        "redux": "^4.0.5",
        "redux-thunk": "^2.3.0",
        "redux-logger": "^3.0.6",
        "socket.io-client": "^3.1.1"
    },
    "devDependencies": {
        "@craco/craco": "^6.1.1",
        "compression-webpack-plugin": "6.1.1",
        "webpack-bundle-analyzer": "^4.4.0"
    },

Error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   peer react@">= 16" from react-scripts@4.0.2
npm ERR!   node_modules/react-scripts
npm ERR!     peer react-scripts@"^4.0.0" from @craco/craco@6.1.1
npm ERR!     node_modules/@craco/craco
npm ERR!       dev @craco/craco@"^6.1.1" from the root project  
npm ERR!     react-scripts@"^4.0.2" from the root project       
npm ERR!   react@"^17.0.1" from the root project
npm ERR!   1 more (recharts)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-resize-detector@5.2.0  
npm ERR! node_modules/recharts/node_modules/react-resize-detector
npm ERR!   react-resize-detector@"^5.2.0" from recharts@2.0.4
npm ERR!   node_modules/recharts
npm ERR!     recharts@"*" 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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
idastambukcommented, Feb 10, 2021

Part of OP’s error is regarding react-resize-detector, which isn’t an NPM bug, since the version in recharts for resize-detector doesn’t include major versions. I’m currently facing the same issue and, even though --legacy-peer-deps works, it would be ideal that the dependency is updated in recharts.

Should I open another ticket for this or reopen this one?

Could not resolve dependency: npm ERR! peer react@"^16.0.0" from react-resize-detector@5.2.0 npm ERR! node_modules/recharts/node_modules/react-resize-detector npm ERR! react-resize-detector@"^5.2.0" from recharts@2.0.6 npm ERR! node_modules/recharts npm ERR! recharts@"^2.0.3" from the root project

1reaction
avindracommented, Feb 10, 2021

@idastambuk I bumped react-resize-detector on my abandoned PR #2426 https://github.com/recharts/recharts/pull/2426/commits/18b0aa69d993d26846c29eacde5ad15eaefb9092 and it seemed well.

Thanks for pointing out the issue, I opened #2431 with the detail.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React v17.0 – React Blog
We're fixing many of those problems with React 17. ... Refer to the documentation for detailed installation instructions.
Read more >
Can't install on React 17 create-react-app project · Issue #1420
Hi, As the title says, npm won't install react-vis on a create-react-app project with React 17. Here's the console error log: npm ERR!...
Read more >
React - Error while updating from 17.0.1 to 17.0.2 [duplicate]
I'm using npm v 7.4. It seems that some dependencies are incompatible with react 17. Do I understand correctly? But npm shows e....
Read more >
Fix Error We no longer support global installation of ... - YouTube
Fix ErrorYou are running create- react -app 4.0.3 which is behind the latest release 5.0.0We no longer support global installation of Create ...
Read more >
Troubleshooting | React Navigation
Sometimes it might even be due to a corrupt installation. If clearing cache didn't work, try deleting your node_modules folder and run npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found