Deploying a Nest App
You can find the step-by-step deployment guide here.
Application Build Copy link
Hostman uses the following environment when building a Nest application:
- Node.js: 20, 22, or 24
- npm
- yarn
The application is built in the repository root or in the directory specified in the Project directory path field.
If the project has a package.json file and uses yarn, we will run:
apt remove -y cmdtest yarn
npm install --global yarn
cd /<DIRECTORY> && yarn install --check-filesIn all other cases, if the a package.json file is present:
cd /<DIRECTORY> && npm install<DIRECTORY> is the path to the directory with package.json.
The default start command is:
npm run start:prodMake sure that the start:prod command is defined in the scripts section of your package.json. For example:
"scripts": {
"start:prod": "node dist/main.js"
}
Troubleshooting Copy link
Deployment fails Copy link
If there are problems with deployment, first check the deployment log. You will be able to determine at what point something went wrong.
Often the problems are related to the start command. Make sure that all modules required to run the application are present in the package.json file.
Please add build instructions to your script section in package.json Copy link
The problem is that the npm run build command accesses the package.json file, and if the value of the build directive is not specified, an error occurs.
To fix this, you need to add the necessary directives to the scripts section of the package.json file. Read more about using scripts here.