Verify canary release
Provide environment informationWhich 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 fasterhttps://github.com/splashsaver/splashsaver.com To Reproduce
Describe the BugWhenever I try to build my Turborepo project I get the following error.
More info: I get the same error in my When I run the Turborepo project locally the page returns an
Expected BehaviorSuccessful builds. Which browser are you using? (if relevant)No response How are you deploying your application? (if relevant)No response |
Replies: 157 comments 194 replies
|
Furthermore, you can likely drop |
|
Have the same issue |
|
SOLVED: |
|
Same issue, but with useRouter |
|
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. 🤷 |
|
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. |
|
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 |
|
Same error in next ^13.4.4 |
|
Same error in Next 13.4.6 under Downgrading to Next 13.4.5 works |
|
Had a same problem in 13.3.0, solved in 13.4.7. |
|
Dealing with this extremely frustrating error for several days now. |
|
I faced the same issue and it was fixed in 13.4.7 version |
|
I have this issue right now, any solution? |
|
My issue was seemingly caused by version mismatches in subdependencies. When I ran I tried When I re-ran And builds worked after this. |
|
Getting same issue on |
|
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. |
|
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). |
|
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 |
|
Ended up moving to regular nextjs application instead of using turbo. What a waste of time to see while deploying |
|
fixed this by not useing turbopack in dev mode |
|
I was able to fix this by adding |
|
You also get this error if you call |
|
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 |
|
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. |
|
For me the issue was that the app I was trying to build had its own node_modules even though we use the root node_modules in this monorepo. Deleting node_modules from the app directory solved the build issue for me. |
|
for turbo packages ensure to use same react version across all packages |
|
Using same react versions fixed this issue in Turborepo setups-
Check react versions using this command |
|
To anyone who's still looking for an answer — I found mine here 🙂 |




I was able to fix this by adding
NODE_ENV=productionbefore build command.