Prepare the application
- Commit a package-lock.json or another supported lock file so production installs are repeatable.
- Define a production start command and make the application listen on the port supplied by the hosting environment.
- Keep secrets in environment variables and exclude local .env files from source control.
- Write logs to standard output or an application log location that will not grow without control.
Deploy the files and runtime
- Create the website in Enhance and select the available Node.js application type or runtime.
- Upload or pull the application files into the assigned application directory.
- Choose the supported Node.js version required by the project.
- Add production environment variables in the panel rather than embedding them in client-side code.
- Install dependencies and run the production build command if the framework needs one.
- Set the start file or command, start the application and inspect the runtime log.
If the application will not start
- Confirm the selected Node.js version satisfies package requirements.
- Check that the production dependency install completed without post-install or native-module errors.
- Confirm the application listens on the environment port and not only on localhost with a fixed port.
- Check file-name capitalization because Linux paths are case-sensitive.
- Inspect the first error in the log rather than repeatedly restarting the process.
Official references
Platforms and tools change over time. Use these official references for the current product documentation.