NODE_RUN_ENV variable in the panel to control how the egg builds and starts your Next.js app. The two supported values are production and development.
- Production
- Development
Set
NODE_RUN_ENV to production.In production mode, the egg runs next build before starting the server. This compiles your app into an optimized output — smaller bundles, static generation, and better runtime performance.Startup sequence:- Install dependencies
- Run
next build(this can take a minute or more depending on your app’s size) - Run
next start -p $SERVER_PORT
- All environment variables needed at build time must be present before the server starts. Use the
.env.pterodactylinjection method to supply them. - Missing build-time env vars will cause
next buildto fail.
Port configuration
Your app must not hardcode a port. The egg passesSERVER_PORT to Next.js at runtime via the -p flag. Do not set a fixed port in next.config.js — it will conflict with the value the egg provides.
Startup detection
The panel marks your server as Started when it sees one of these strings in the console output:| String | Emitted by |
|---|---|
ready on | Next.js 13 and earlier |
started server on | Next.js internals |
Local: http:// | Next.js 14+ dev output |
Compiled successfully | Dev mode compilation |
listening on | Custom server or adapter output |
▲ Next.js | Next.js 13+ startup banner |