Error: Cannot find module 'react-is' - Production build
See original GitHub issueWhat version of Next.js are you using?
12.0.2
What version of Node.js are you using?
16.13.0
What browser are you using?
Chrome
What operating system are you using?
macOS, M1
How are you deploying your application?
next start
Describe the Bug
next dev is working as expected.
When I run next build
followed by next run
and visit the URL, I get the following error in the console and a large part of the application renders blank.
Expected Behavior
It probably shouldn’t throw this error, unless I’m missing something in my setup.
To Reproduce
There isn’t much more context I can give, I think. I’m not sure if it helps to get my entire package.json but I will of course post it if someone needs it for debugging.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:45 (10 by maintainers)
Top Results From Across the Web
Error: Cannot find module react when trying to run npm start
After a week I have finally found a solution. First I tried reinstalling an older versions of node and npm, which did not...
Read more >Cannot find module 'react' Error in TypeScript | bobbyhadz
To solve the "Cannot find module react or its corresponding type declarations" error, install the module and its type definitions by running the...
Read more >Fix - Cannot find module 'react' error - Reactgo
The can't find module 'react' error occurs, if you're trying to access a react module that is not currently installed in your project....
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >Error: Cannot find module 'react' || Solved - YouTube
In this video, we will solve Error : Cannot find module ' react ' in reactjs. #command : npm install --save react react...
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
In case anyone is interested, here is a
docker-compose.yml
file that reproduces the issue:Drop that in a directory by itself, then run
docker-compose up
. Open http://127.0.0.1:8080 in your browser and check the console logs after a refresh. There should be no errors.Hit CTRL+C to stop the container. Next, run
NODE_ENV=development docker-compose up
. Reloading the page should now show the error in the console.It would be great if
next export
could detect this problem and warn the user. It would save a lot of time and frustration tracking this down.Happened to me as well 😂
Make sure
NODE_ENV=production
whilenext build
instead ofNODE_ENV=development
.