Node.js: Node.js version
How Stackhero selects and manages the Node.js version for your application
👋 Welcome to the Stackhero documentation!
Stackhero delivers a ready-to-use Node.js cloud environment designed to help you move faster:
- Deploy to production in seconds with a simple
git push. No extra tooling or manual setup is required.- Bring your own domain and benefit from automatic HTTPS certificates, keeping your application secure without extra configuration.
- Automatic backups, one-click updates, and predictable pricing help you focus on shipping features, and Stackhero manages the infrastructure for you.
- Built on private, dedicated infrastructure for consistent performance and strong security.
Save time and reduce operational overhead: you can have your application running on Stackhero's Node.js cloud hosting in just a few minutes.
Your Node.js version is defined in your repository, not in a dashboard setting. This approach means the runtime version travels with your code, is reviewed alongside your merge requests, and can be reverted by rolling back a commit. There is nothing to manually update or remember before deployment: your code and its runtime are always in sync.
How Stackhero selects your Node.js version
At every deployment, Stackhero looks for the first matching specification in this order:
-
imagein yourstackhero.yml. This pins the exact container image, and all other options are skipped.image: node:24-alpine3.21 -
engines.nodein yourpackage.json.{ "engines": { "node": "24.x" } } -
.nvmrcfile.24 -
.node-versionfile.24.9.0
If none of these are found, Stackhero defaults to the current Long Term Support (LTS) release, which suits most projects.
The selected Node.js version and image are printed at the top of your deployment output, so you always know what is running:
Language : nodejs 24
Base image : node:24-slim
Ranges give you the latest release in a line
Specifying a range like 24.x, >=24.5.0, or ^24.0.0 gives you the newest available 24.x release. This ensures you receive every security fix and patch made to that line, without manual intervention.
To lock to a specific release, specify the exact version:
{
"engines": {
"node": "24.9.0"
}
}
Version files require a number
.nvmrc can accept aliases like lts/iron or node, but these do not map to a specific installable release. In such cases, Stackhero proceeds to the next version source in the list. Your deployment output clearly indicates if this happens.
A version number is all that is needed:
24
Staying on the LTS line
When no version is pinned, each deployment uses the current LTS release. This means you automatically receive major, minor, and security updates as they are published. Your deployment output will inform you when the base image changes:
The base image "node:lts-slim" changed: Node.js 24.9.0 to 26.2.0.
This process is designed to be safe. Your new deployment must start and respond before any traffic is sent to it. If your application is not compatible with a new major version, the previous version continues to serve users without interruption.
If you prefer to control the upgrade schedule, you can pin your current version line:
image: node:24-slim
Choosing your own image
The image field accepts any tag from the official Node.js Docker images and uses it exactly as written:
image: node:24-alpine3.21
Be sure to include the full tag and use an official Node.js image. These two requirements allow Stackhero to reliably manage your deployment, from installing dependencies to starting your app. If you specify an unsupported image, this is reported before the build begins, and your running application is not affected.
Alpine tags produce smaller images that start quickly. If your project uses dependencies that require native code compilation, you may need a Debian-based image. If an install fails with Alpine, switching to a
-slimtag typically resolves it.