Replies: 153 comments 188 replies
-
Furthermore, you can likely drop |
Beta Was this translation helpful? Give feedback.
-
Have the same issue |
Beta Was this translation helpful? Give feedback.
-
SOLVED: |
Beta Was this translation helpful? Give feedback.
-
Same issue, but with useRouter |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, I was running into this same issue on Node 16.16.0, and upgrading to 18.5.0 resolved it. 🤷 |
Beta Was this translation helpful? Give feedback.
-
Got this error after upgrading the app from Next 13.1.6 to the latest Next 13.4.0, including some other dependencies, and deploying to Vercel:
Locally everything is perfect. Fails on Vercel. Made sure that local and remote Node version is 18. That didn't help. |
Beta Was this translation helpful? Give feedback.
-
I am still getting this error in 13.4.3 , however I am using turbo repo on top of it which seems to trigger the bug |
Beta Was this translation helpful? Give feedback.
-
Same error in next ^13.4.4 |
Beta Was this translation helpful? Give feedback.
-
Same error in Next 13.4.6 under Downgrading to Next 13.4.5 works |
Beta Was this translation helpful? Give feedback.
-
Had a same problem in 13.3.0, solved in 13.4.7. |
Beta Was this translation helpful? Give feedback.
-
Dealing with this extremely frustrating error for several days now. |
Beta Was this translation helpful? Give feedback.
-
I confirm this in 13.4.8, I downgraded to 13.4.5 and the same thing. |
Beta Was this translation helpful? Give feedback.
-
Out of curiosity are you using React Context? Or a library that uses React Context? |
Beta Was this translation helpful? Give feedback.
-
I faced the same issue and it was fixed in 13.4.7 version
|
Beta Was this translation helpful? Give feedback.
-
I have this issue right now, any solution? |
Beta Was this translation helpful? Give feedback.
-
I found a solid solution that works well for me on all Next.js apps and versions.Steps to Fix the Error
If this works (it has worked for me in all cases so far, though the file may differ between production and development environments), proceed to automate the fix.
Example package.json{ Post-Install Script: patchNodeModule.js
|
Beta Was this translation helpful? Give feedback.
-
Happening to me now too also on 14.2.18. Found the fix though - you just need to delete the entire project and the error goes away. |
Beta Was this translation helpful? Give feedback.
-
I ran into this issue in a monorepo where multiple versions of react were specified between different apps/packages. It turns out the issue having those multiple versions available. In this monorepo we're using npm as the package manager with the I hope this helps. |
Beta Was this translation helpful? Give feedback.
-
The same error, I use
|
Beta Was this translation helpful? Give feedback.
-
My issue was seemingly caused by version mismatches in subdependencies. When I ran I tried When I re-ran
And builds worked after this. |
Beta Was this translation helpful? Give feedback.
-
Getting same issue on
|
Beta Was this translation helpful? Give feedback.
-
had similar issue and reported here. #65447 (comment) I've resolved the issue on my end, and it turned out to be related to pnpm. As mentioned in this discussion: I added NODE_ENV=development, which revealed that my layout was using useState, causing a prerendering error. Strangely, Next.js initially showed a different error message. Even though I had already added "use client", the issue persisted when building with pnpm. How to Fix (if you're using pnpm):
✅ Done! This should help identify and resolve the issue more easily. |
Beta Was this translation helpful? Give feedback.
-
If using a pnpm monorepo, you can resolve this by creating an
Then Other docs suggested putting This will isolate versions of react in your monorepo so that they won't override eachother if you have multiple packages with different React versions. This resolved my issue where NextJS's react version (v19.x) was disagreeing with Expo's react version (v18.x). |
Beta Was this translation helpful? Give feedback.
-
For me, this happens whenever I import my component with export const layouts = {
DefaultPageLayout: dynamic(() => import('./DefaultPageLayout.js')),
}; This worked in my Monorepo, but then I created a library for my components, and doesn't work anymore. If I use React.lazy, or just the component itself, it works, but with |
Beta Was this translation helpful? Give feedback.
-
Ended up moving to regular nextjs application instead of using turbo. What a waste of time to see while deploying |
Beta Was this translation helpful? Give feedback.
-
fixed this by not useing turbopack in dev mode |
Beta Was this translation helpful? Give feedback.
-
I was able to fix this by adding |
Beta Was this translation helpful? Give feedback.
-
You also get this error if you call |
Beta Was this translation helpful? Give feedback.
-
for me I have to go to next/dist/compiled/next-server/app-page.runtime.dev.js file and place question mark in return t.useContext => return t?.useContext note don't change all t.context just 2 of them that are like return t.useContext it is likely bug in next 13 i am using 13.4.9 |
Beta Was this translation helpful? Give feedback.
-
My own experience was this happened when I mistakenly put
Once I removed that (which I think is handled by next.js automatically) everything worked fine. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Verify canary release
Provide environment information
Which area of Next.js is affected? (leave empty if unsure)
Other
Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster
https://github.com/splashsaver/splashsaver.com
To Reproduce
yarn install
.yarn build
.Describe the Bug
Whenever I try to build my Turborepo project I get the following error.
TypeError: Cannot read properties of null (reading 'useContext')
More info:
I get the same error in my
web
app but with the respective paths, thedocs
app builds successfully.When I run the Turborepo project locally the page returns an
Internal Server Error
message and I get the following error.TypeError: Cannot read properties of null (reading 'useReducer')
Expected Behavior
Successful builds.
Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Beta Was this translation helpful? Give feedback.
All reactions