Next.js Discord

Discord Forum

NextJS 15.0.4 build failed

Unanswered
Round sardinella posted this in #help-forum
Open in Discord
Avatar
Round sardinellaOP
I have an error when build nextjs app

│ yarn run v1.22.22
│ $ next build
│ ▲ Next.js 15.0.4

│ Creating an optimized production build ...
│ ✓ Compiled successfully
│ ✓ Linting and checking validity of types
│ ✓ Collecting page data
│ TypeError: Cannot read properties of null (reading 'useContext')
│ at exports.useContext (/Users/liam/code/themoment/themoment-monorepop/apps/tmm-core/node_modules/react
│ /cjs/react.production.js:488:33)
│ at h (/Users/liam/code/themoment/themoment-monorepop/apps/tmm-core/.next/server/pages/_error.js:1:6054
│ )
│ at renderWithHooks (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/reac
│ t-dom/cjs/react-dom-server.edge.production.js:4189:18)
│ at renderElement (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/react-
│ dom/cjs/react-dom-server.edge.production.js:4327:14)
│ at retryNode (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/react-dom/
│ cjs/react-dom-server.edge.production.js:4871:16)
│ at renderNodeDestructive (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_module
│ s/react-dom/cjs/react-dom-server.edge.production.js:4689:7)
│ at renderNode (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/react-dom
│ /cjs/react-dom-server.edge.production.js:5128:14)
│ at renderChildrenArray (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/
│ react-dom/cjs/react-dom-server.edge.production.js:5019:7)
│ at retryNode (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_modules/react-dom/
│ cjs/react-dom-server.edge.production.js:4885:9)
│ at renderNodeDestructive (/Users/liam/code/themoment/themoment-monorepop/node_modules/next/node_module
│ s/react-dom/cjs/react-dom-server.edge.production.js:4689:7)
│ Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error

1 Reply

Avatar
Dwarf Hotot
I cause because there will an error in below of the followings :

* Calling api
* Data hydration
* Using wrong syntax