Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React 18 release broke create-react-app appname --template redux #1881

Closed
1 task
minaelee opened this issue Mar 30, 2022 · 3 comments
Closed
1 task

React 18 release broke create-react-app appname --template redux #1881

minaelee opened this issue Mar 30, 2022 · 3 comments

Comments

@minaelee
Copy link

What version of React, ReactDOM/React Native, Redux, and React Redux are you using?

  • create-react-app@5.0.0

What is the current behavior?

When I use the command:

npx create-react-app someappname --template redux

Since yesterday when React 18 was released as production, I now get this error every time:

image

Here it is again in text:

Installing template dependencies using npm...
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: noversionplusredux@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR! react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.3 || ^17" from react-redux@7.2.6
npm ERR! node_modules/react-redux
npm ERR! react-redux@"^7.2.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 C:\Users\minae\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\minae\AppData\Local\npm-cache_logs\2022-03-30T07_04_35_242Z-debug.log
npm install --no-audit --save @reduxjs/toolkit@^1.5.1 @testing-library/jest-dom@^4.2.4 @testing-library/react@^9.3.2 @testing-library/user-event@^7.1.2 react-redux@^7.2.3 failed

What is the expected behavior?

It creates a react-redux app as normal.

Which browser and OS are affected by this issue?

n/a

Did this work in previous versions of React Redux?

  • Yes
@markerikson
Copy link
Contributor

Yeah, this is an unfortunate consequence of both CRA and NPM default behavior:

  • CRA apparently always installs the latest React by default
  • NPM now always installs peer deps, and errors if it can't find a match.

I may have to put out a React-Redux v7.2.x emergency patch that bumps the peer dep to accept React 18 just to work around this, although I don't like that.

The real solution is that we need to finish up React-Redux v8 and release it, but that'll be at least a couple weeks.

See #1740 (comment) for some additional thoughts.

@compulim
Copy link

compulim commented Mar 30, 2022

Agree on NPM default behavior. But I think an emergency patch makes sense.

I have a non-CRA project. It is a React UI component library:

  • Uses react-redux@7.2.6
  • Has peer deps of react-dom@>=16.8.3
  • No dev/deps to react or react-dom

After react@18 is released, the CI pipeline of the project suddenly broke with zero code change.

NPM try to "look at" react because the project says it wants react-dom@>=16.8.3. So NPM picks the react@18, then it conflicted.

On the other side, if the project doesn't have peer deps set, it is fine.

Minimal repro. It will fail when running npm install or npm ci with the following package.json, with or without package-lock.json.

{
  "name": "test-component",
  "version": "0.0.0-0",
  "dependencies": {
    "react-redux": "7.2.6"
  },
  "peerDependencies": {
    "react-dom": ">= 16.8.3"
  }
}

@markerikson
Copy link
Contributor

I've put out React-Redux 7.2.7 as a stopgap, but the real answer is we need to get v8 out the door.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants