React Invariant thrown during Next.js `next build`
See original GitHub issueWith, npm ls react
you can see react@16.14.0
is not deduped, and everything else is on react@17.0.2
...
├─┬ react-dom@17.0.2
│ └── react@17.0.2 deduped
...
├─┬ react-live@2.4.0 (...same issue w/ 2.3.0)
│ ├─┬ prism-react-renderer@1.2.1
│ │ └── react@17.0.2 deduped
│ └─┬ react-simple-code-editor@0.11.0
│ ├─┬ react-dom@16.14.0 <-----------------not deduped
│ │ └── react@16.14.0 deduped
│ └── react@16.14.0 <-----------------not deduped
...
├── react@17.0.2
...
I believe this is preventing my Next.js project from building, due to the more than one copy of React React invariant.
… strangely it only happens when installing everything w/ npm
and not yarn
Side: react-simple-code-editor
https://github.com/satya164/react-simple-code-editor/blob/master/package.json#L62-L65 doesn’t specify react/-dom 17
as a peer dependency. (It also hasn’t seen a new update in close to 2 years now 😕)
Update: Opened a PR to allow react 17 as a peerDep
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Nextjs throws Invalid React hooks Error on next dev
When starting server using node app/app.js , the page is loading just fine. But when I run next dev app/src/next or next build...
Read more >react-hydration-error - Next.js
React Hydration Error. Why This Error Occurred. While rendering your application, there was a difference between the React tree that was pre-rendered ...
Read more >Migrating from React Router - Next.js
First, uninstall React Router. You'll be migrating to the built-in routing with Next.js. npm uninstall react-router-dom. The Link component for performing ...
Read more >Routing: Error Handling - Next.js beta docs
Next.js 13 introduced a new file convention, error.js , to help you handle errors in your application. This convention, built on React Error ......
Read more >Advanced Features: Error Handling - Next.js
React Error Boundaries is a graceful way to handle a JavaScript error on the client so that the other parts of the application...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jpdriver
Re: original issue, I was able to work around using npm overrides
“react-live”: “^2.3.0”
package.json
“react-live”: “^3.0.0-rc1”
This looks to allow react to be deduped 🎉 ,
npm ls react
But it looks like it introduces a regression where a previously used
style
prop is no longer passed along.Hey @jpdriver, awesome! I can test this out in my next chunk of free time and get back to you
And for my context, was that replacement https://github.com/FormidableLabs/use-editable?