Release new version compatible with React 17
alexandernst opened this issue · comments
React 17 was just released. There are no breaking changes, but if I try to use it with this package, I get warnings about missing peer-dependencies (this package depends on react@16.x).
Can you release a new version making this package compatible with React 17? @blainekasten
I'll gladly create a MR if you're willing to merge it and release a new version :)
@alexandernst Yes please, put up a PR and i'll get a version released!
@blainekasten Done! #432
I also changed "create-react-context"
to "^0.3.0"
as I'll try to push that library to React 17 as well.
@sfcgeorge Wrote a wonderful synopsis about this issue in PR (#432) which I feel should be captured here.
I'm surprised that this still has not been done at this point in time. For context, anyone using Gatsby, witch has reach router under the hood, cannot use this router at all with React 17. So...?
@david-j-davis I hear you. Lots of Gatsby and Storybook users visit this Issue and the related PR's.
For GastbyJS 3.0 users, they can look at this work-around for their Jest tests: https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v2-to-v3/#reach-router
When using NPM v7, you will get an error instead of a warning, which is a bit disturbing. By using Storybook I just can't use npm install because of this issue. Any news or workaround about this ?
Possibly the only way to get around it with npm7+ for the moment is using the --force
or --legacy-peer-deps
flag.
Of course, you can use yarn
or other similar like pnpm
as many have suggested. The idea is the same though -- just ignore peer dependency conflict. Yes. It's like sweeping your rubbish under your carpet and I'm quite against it. But... life as a js developer is predetermined to be very hard...
@ryanflorence @blainekasten @chaance @cassidoo @marcysutton @mjackson
Are you still be able to help to release a new version if we submit a PR for that?
Nobody working on this issue?
Can you release a new version making this package compatible with React 17? @blainekasten
This issue is already known and has an active PR on storybook's repo
@VictorGaiva This one? storybookjs/storybook#14619
Is it possible to make this compatible with React 17, please?
Node 16 has just moved to LTS which includes npm version 8. Anyone moving to this new node LTS version and using latest versions of react (17) and @reach/router will encounter npm install failures for the first time due to this. So lots of people are about to run into this problem.
PS C:\path> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-project@undefined
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR! react@"17.0.2" from the root project
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/@reach/router
npm ERR! @reach/router@"1.3.4" 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\username\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\username\AppData\Local\npm-cache\_logs\2021-10-28T07_21_28_487Z-debug.log
Is it safe for the time being to just run with --legacy-peer-deps
?
If you're hitting this issue with the strict enforcement of legacy peer dependencies, you'll probably get an error that looks like:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @you/your-project@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!
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/@reach/router
npm ERR! @reach/router@"*" 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.
To fix this properly (i.e. without using --legacy-peer-deps
), you can use @gatsbyjs/reach-router
instead, which is a drop-in replacement with React 17+ support. The typings have just been added for this module so you can use it in TypeScript projects too.
- Uninstall reach router with
npm uninstall @reach/router
- Install Gatsby version with
npm install @gatsbyjs/reach-router
- (if using TypeScript) Install typings with
npm i @types/gatsbyjs__reach-router
- Replace any imports of
@reach/router
with@gatsbyjs/reach-router
in your project