Next.js Discord

Discord Forum

Dev server is crashing at random time, if i restart it again it works

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Northeast Congo LionOP
Server Error
TypeError: Cannot read properties of null (reading 'useContext')

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
Next.js
t.useContext
file:///Users/me/Desktop/Work/work/tool/frontend/nodemodules/.pnpm/next@14.2.5@babel+core@7.24.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:162241)
useContext
nodemodules/.pnpm/next@14.2.5@babel+core@7.24.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/src/client/components/navigation.ts (84:10)
ErrorBoundary
nodemodules/.pnpm/next@14.2.5@babel+core@7.24.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/src/client/components/error-boundary.tsx (172:23)
au
file:///Users/me/Desktop/Work/work/tool/frontend/nodemodules/.pnpm/next@14.2.5@babel+core@7.24.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:10446)
<unknown>
file:///Users/me/Desktop/Work/work/tool/frontend/nodemodules/.pnpm/next@14.2.5@babel+core@7.24.9_react-dom@18.2.0_react@18.2.0/node_modules/next/dist/compiled/next-server/app-page.runtime.dev.js (35:15122)
aw

5 Replies

Northeast Congo LionOP
It's working fine when i restart it but why it's crashing
Black Turnstone
I got this exact same issue, it randomly occurs, also after deleting the node_modules and restarting the dev server. Deleting node_modules doesn't make a difference to just restarting and waiting for the error occur again after some time.

Did you find a way to eventually fix this? I'm in a Turbo Repo.
@Northeast Congo Lion
Northeast Congo LionOP
I had no issues after updating to next 15
Dwarf Crocodile
I also had this error very very very very often and it was killing me, no solution proposed on internet solved it
Upgrading to NextJS15 seems to have fixed the issue, I did not have it so far