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.

ERESOLVE unable to resolve dependency tree - missing support for react@17.0.2

See original GitHub issue

Describe the bug Project cannot be run if react@17.0.2 is the only react dependency.

When running npm install, I get the following error:

% npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
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 || ^17.0.0" from @storybook/react@6.3.6
npm ERR!   node_modules/@storybook/react
npm ERR!     dev @storybook/react@"^6.3.6" from the root project
npm ERR!   7 more (react-dom, @storybook/addons, @storybook/core, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"15.x || 16.x || 16.4.0-alpha.0911da3" from @reach/router@1.3.4
npm ERR! node_modules/@storybook/api/node_modules/@reach/router
npm ERR!   @reach/router@"^1.3.4" from @storybook/api@6.3.6
npm ERR!   node_modules/@storybook/api
npm ERR!     @storybook/api@"6.3.6" from @storybook/addons@6.3.6
npm ERR!     node_modules/@storybook/addons
npm ERR!       @storybook/addons@"6.3.6" from @storybook/react@6.3.6
npm ERR!       node_modules/@storybook/react
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/jakob/.npm/eresolve-report.txt for a full report.

To Reproduce Copy and paste this package.json and run npm install:

{
  "name": "repro",
  "scripts": {
    "storybook": "start-storybook -p 6006"
  },
  "devDependencies": {
    "@babel/core": "^7.15.0",
    "@storybook/react": "^6.3.6",
    "babel-loader": "^8.2.2",
    "typescript": "^4.3.5"
  },
  "dependencies": {
    "react": "^17.0.2"
  }
}

System Please paste the results of npx sb@next info here.

% npx sb@next info

Environment Info:

  System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
  Binaries:
    Node: 16.1.0 - ~/.nvm/versions/node/v16.1.0/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 7.11.2 - ~/.nvm/versions/node/v16.1.0/bin/npm
  Browsers:
    Chrome: 92.0.4515.131
    Firefox: 85.0
    Safari: 14.1.1

Additional context Add any other context about the problem here.

Adding react@16 to package.json seems to work.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
HassenHichricommented, Aug 6, 2021

We run into the same problem, it looks like the problem coming from reach-router as a dependency of @storybook/api https://github.com/reach/router/blob/master/package.json

0reactions
brianpmahercommented, Mar 1, 2022

Ah I was on 6.3, but after upgrading to 6.4 I’m no longer seeing this issue. Thanks 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to resolve dependency tree Reactjs - Stack Overflow
This error comes from version 7.x of npm. Please try again with the --legacy-peer-deps option. Share.
Read more >
"Could not resolve dependency" error with "react@^16.0" #9426
Installing @react-navigation/stack fails due to dependency error. ... ERESOLVE unable to resolve dependency tree npm ERR! npm ERR!
Read more >
How to Fix npm ERR ERESOLVE Unable to Resolve ...
Command:- npm config set legacy-peer-deps trueIn This Video We Will See How to Fix npm ERR ERESOLVE Unable to Resolve Dependency Tree ......
Read more >
eresolve unable to resolve dependency tree in react - You.com
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...
Read more >
material ui unable to resolve dependency tree Code Example
how to deal with ERESOLVE unable to resolve dependency tree ... Try to run the command with --force, or --legacy-peer-deps. ... it causes...
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