Setting the Node.js Version for Nixpacks Builds

Flightcontrol's default Nixpacks build type uses Node.js 16 by default.

This may not be the version of Node that you use for your own project, so Nixpacks supports setting the Node.js version for your builds.

The supported major versions of Node.js are 14, 16, and 18.

Using the package.json File

We recommend setting the Node version in your package.json file, so that it's clear to anyone working on your project what version of Node is required. This also works with other build and continuous integration tools.

To set the Node version in your package.json file, add the following to the top level of your package.json file:

{
  "engines": {
    "node": "18"
  }
}

Nixpacks will use the version of Node.js specified in your package.json file.

Providing a NIXPACKS_NODE_VERSION Environment Variable

The other alternative is to tell the Nixpacks build to use a specific version of Node.js by setting the NIXPACKS_NODE_VERSION environment variable. Set this environment variable to one of the supported major versions of Node.js (14, 16, or 18).

For example, to use Node.js 18, you would set the NIXPACKS_NODE_VERSION environment variable to 18.

This alternative is useful if you don't want to modify your application code, but we do recommend setting the version of Node you use in your package.json file.