Skip to content

NODE_ENV=development next build fails on static 404 and 500 pages #25491

@mercteil

Description

@mercteil

What version of Next.js are you using?

10.2.3

What version of Node.js are you using?

14+

What browser are you using?

Chrome

What operating system are you using?

macOs

How are you deploying your application?

next start

Describe the Bug

After updating from 10.1.3 to 10.2.3 and script execution NODE_ENV=development npm run build (=> next build) the following error appears:

info  - Creating an optimized production build
info  - Compiled successfully
info  - Collecting page data
[==  ] info  - Generating static pages (0/4)

Error occurred prerendering page "/en/404". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot assign to read only property 'children' of object '#<Object>'

(...)

> Build error occurred
Error: Export encountered errors on following paths:
	/de/404
	/de/500
	/en/404
	/en/500

When executing the same script with NODE_ENV=production npm run build everything works as expected.

Downgrading next to 10.1.3 resolves the issue.

Why do I need to set NODE_ENV? Several configuration options depend on the NODE_ENV. For exmaple in development a different backend url and DB is being accessed etc.

Expected Behavior

NODE_ENV=development next build works as it did in 10.1.3

To Reproduce

NODE_ENV=development next build

Building static 404 and 500 pages fails...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions