Step 1. Create a service
Step 2. Select the project to deploy
If you are logged in to Hostman with your GitHub, GitLab or Bitbucket account, at this point you will see the repository with your projects, including the private ones.
To access a different repository, click Connect another repository.
If you didn’t use your Git account credentials to log in, you’ll be able to access the necessary account now, and then select the project.
Step 3. Choose a server
Your Next.js application must run on a specific cloud server. Choose the location and configuration of this server. You can upgrade it in the future.
Step 4. Configure the build settings
Next, the App customization window will appear.
First, select NodeJS environment and then Another Node framework from the list of frameworks.
Then fill in the Start and Build commands.
If the build and start directives are set in the scripts section of your package.json file, you can use the standard commands:
If necessary, you can customize the commands adding extra parameters and modules. You can enter multiple commands separated by &&.
Step 5. Deploy
Click Deploy to start the build process.
Once it starts, you will enter the deployment log. The log contains all the debugging data you'll need. If there are any issues with the code, you will get warning or error messages in the log, specifying the cause of the problem.
Usually it takes some time to install the cloud server during the first deployment.
When the deployment is complete, you will receive an e-mail notification and also see a similar log entry:
Your project is up and ready.
If your application requires a particular Node version, you can specify it in the settings by doing one of the following:
By adding the NODE_VERSION environment variable to your application and setting its value as your preferred version, for example, 12.18.3.
By adding a .node-version file containing the full semantic Node version to the root directory of your project repository.
By using the engines directive in your package.json file which will allow you to set either a specific Node version (for example, 12.18.3) or a range (for example, >=12.18. <13.2).
The deployment fails
If the deployment fails, first of all check the deployment log. You'll see the stage where something went wrong.
The most common issues are with the start command. Check that all the modules you need to launch the application are in the package.json file.
Also, we are here to help, so don't hesitate to ask us about the causes via chat.