-
Notifications
You must be signed in to change notification settings - Fork 27.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
next build failing after fresh npx create-next-app@latest #50434
Comments
same issue
|
We cannot recreate the issue with the provided information. Please add a reproduction in order for us to be able to investigate. Why was this issue marked with the
|
same here |
As mentioned above, please add a reproduction 🙏 |
I had a similar issue. Downgrading |
got the same error: "dependencies": { => Error occurred prerendering page "/_not-found". Read more: https://nextjs.org/docs/messages/prerender-error |
These are the parts to reproduce the issue. The last line where you run "next build" directly, and not "npm run build" is crucial and reproduces the error This would assume you have next installed globally (npm i -g next) |
√ What is your project named? ... test i ran -> npm run build ....
⚠ You are using a non-standard "NODE_ENV" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env |
next is not globally installed on my system: |
@happydayxxl I was just providing clearer instructions on how to reproduce the error described in the issue by @thimmey . Your error seems like a different error, with other steps needed to reproduce it. Might be better to create a separate issue for that one. |
Same error randomly occurred the production build for us after upgrade the next to the latest stable version...
Build environment: nixpacks docker aws |
I could not see a reproduction in any of the follow-up comment, so closing. Feel free to reopen with a new reproduction if you are still seeing this! |
This really reproduces the error. Jus tried it again. |
I was running into the same issue in a few of my side projects, tried rolling back a few versions (13.4.9 seemed to be the last stable release for me). Figured out that it seemed to be happening when attempting to statically render the error pages (404/500), so I added a export default function ErrorPage() {
return <pre>Encountered an error!</pre>
}
export async function getServerSideProps() {
return { props: {} }
} and the builds finally pass (even on newer Next.js versions!) |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
build
Link to the code that reproduces this issue or a replay of the bug
no changes done to the code, coming like this without any modification
To Reproduce
install nextjs and install the standard app through "npx create-next-app@latest"
√ Would you like to use TypeScript with this project? ... No
√ Would you like to use ESLint with this project? ... No
√ Would you like to use Tailwind CSS with this project? ... No
√ Would you like to use
src/
directory with this project? ... No√ Use App Router (recommended)? ... Yes
√ Would you like to customize the default import alias? ... No
I tried also the nextjs canary version, + 6 lower versions (went down to version 13.1.0, there it fails with some google font issues...) for the next installation itself and the next create-next-app.
Describe the Bug
"next build" as it throws error
I'm trying to get the standard version running. Using VS Code on Windows. I created a new app by running "npx create-next-app@latest" After this I am running "next build" and this is failing. I did not modify anything.
For a new joiner like me this is a big frustration.
PS C:\temp\nextjs-testing\my-test-app> next build
[ ] - info Generating static pages (0/3)TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Head (C:\temp\nextjs-testing\my-test-app.next\server\pages_error.js:282:44)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:71:145)
Error occurred prerendering page "/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Head (C:\temp\nextjs-testing\my-test-app.next\server\pages_error.js:282:44)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:71:145)
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Head (C:\temp\nextjs-testing\my-test-app.next\server\pages_error.js:282:44)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:71:145)
Error occurred prerendering page "/500". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Head (C:\temp\nextjs-testing\my-test-app.next\server\pages_error.js:282:44)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at bd (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:77:404)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:217)
at $c (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:78:98)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:71:145)
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Html (C:\temp\nextjs-testing\my-test-app.next\server\pages_document.js:719:114)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Xc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:409)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:210)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:74:209)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of null (reading 'useContext')
at exports.useContext (C:\temp\nextjs-testing\my-test-app\node_modules\react\cjs\react.production.min.js:24:118)
at Html (C:\temp\nextjs-testing\my-test-app.next\server\pages_document.js:719:114)
at Wc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:44)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:253)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Xc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:68:409)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:70:210)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
at Zc (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:74:209)
at Z (C:\Users\Tim\AppData\Roaming\npm\node_modules\next\node_modules\react-dom\cjs\react-dom-server.browser.production.min.js:76:89)
Expected Behavior
no error when trying to build fresh install / created app through "npx create-next-app@latest"
Which browser are you using? (if relevant)
Not relevant
How are you deploying your application? (if relevant)
No
The text was updated successfully, but these errors were encountered: