Configuring Atlas Builds
This guide describes how to configure the Atlas build system for your applications.
Setting a custom version of Node.js, npm and Yarn
By default, Atlas uses the latest v18 LTS release of Node.js. Currently Atlas supports Node.js v16 (deprecated), v18 and v20.
New LTS Node.js versions become available for use within one month of the ‘Initial Release’ and become the default version within one month of the ‘Active LTS Start.’ Please consult Node.js release dates as needed.
To set a custom version of Node.js, use the engines field in the
package.json file. For example, here is how to deploy your application using Node.js 18:
"node": ">=18.0.0 <19.0.0"
Note: Atlas builds use Semantic Versioning to specify the Node.js version. This can be used to specify a specific versions, a range of versions or a major version. If a range is used, ensure that an upper bound is set (e.g. <19.0.0) as the build may use the new node version unexpectedly. For example, a clean rebuild will clear the cached version of Node.js.
The version of Node.js in use on your builds can be found in the build output:
Detecting Node.js version
Searching for the Node.js version in package.json => engines
Using Node.js ">=18.0.0 <19.0.0" from the package.json engines field
nodejs: Contributing to layer
Node.js v18.15.0 installed because it is the latest version that matches the constraint ">=18.0.0 <19.0.0"
To see what version of Node.js you are using on your local machine use the following command:
$ node --version
The builds use the default version of npm that comes with the Node.js release selected. You can use this page to search which version of npm comes with a particular version of Node.js.
You can set a custom version of npm used in Atlas builds in two places. The first is the
engines field in the
package.json file. Similar to Node.js versions above, Atlas uses semver to specify the version used. Here is how to set it to use the latest version of npm v8:
An alternative way to set npm is to use the
packageManager field in the
package.json file. Note the difference in format compared to the
engines field above where the version must be an exact version of npm:
The version of npm being used on your builds can be found in the build output:
Detecting npm version
Searching for the npm version in:
1. package.json => engines
2. package.json => packageManager
Using npm "8" from package.json engines field
npm: Contributing to layer
npm v8.13.2 installed because it is the latest version that matches the constraint "8"
To see what version you have installed locally use:
$ npm --version
yarn.lock file is committed then yarn is used instead of npm to build your application. Currently only Yarn Classic (v1) is supported on Atlas builds.
If you want to set an exact version of Yarn use the
packageManager field in
The version of Yarn being used on your builds can be found in the build output:
Determining yarn version
Yarn v1.22.16 installed
Use this command to see what version you are using locally:
$ yarn --version
It is recommended to commit your
package-lock.json file to version control. Once committed Atlas uses the lock file to run
npm ci to install package dependencies which builds your app with the same dependencies used in your local dev environment.
package-lock.json file is not present then
npm install is run.
Custom Build Commands
This is the command which is run to build your application. Custom build commands can be set on Atlas and per environment.
The build command can be configured 3 ways. In order of priority they are:
ATLAS_BUILD_SCRIPT- Atlas builds look for the
ATLAS_BUILD_SCRIPTenvironment variable. For example,
npm run my-buildwill be run if using npm
wpe-build- if it exists in
npm run wpe-buildis run if using npm
build- if it exists in
Below is an example of how to set each build command:
"my-build": "next build", // only run if ATLAS_BUILD_SCRIPT is set
"wpe-build": "next build",
"build": "next build",
Custom Start Commands
The start command is run to start your Node application once it is deployed. By default Atlas runs the
start script in
package.json. This can be overridden by setting the
ATLAS_START_SCRIPT environment variable. For example,
next dev will be run instead of
next start with the package.json below:
"start": "next start",
"start-dev": "next dev",
Framework Build Assets Cache
Atlas caches common framework assets between builds to optimise build times.
The folders that are cached currently are:
If any of the above folders are in the projects root directory at the start of the build, the build will not override them.
Performing a clean rebuild, either through a webhook or through User Portal, will remove any previously cached files. For instructions on how to perform a clean rebuild you can reference the guide on troubleshooting builds.
Rebuild an Environment via Webhook
This content has moved to a standalone guide. Please reference that guide to configure your webhooks.