Node.js: Node.js runtime version management
How Stackhero selects and manages the Node.js version for your application
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Node.js cloud solution designed to help you move faster:
- Deploy to production in seconds with a simple
git push. No additional tools or manual configuration needed.- Use your own domain and take advantage of automatic HTTPS certificate setup, keeping your application secure with no extra steps.
- Enjoy automatic backups, one-click updates, and predictable, transparent pricing so you can focus on building features while Stackhero manages the infrastructure.
- Benefit from dedicated, private infrastructure for optimal performance and enhanced security.
Save time and simplify your operations: 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 as a dashboard setting. This approach ensures 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 update or remember manually before deployment: your code and its runtime environment are always in sync.
How Stackhero determines your Node.js version
At each deployment, Stackhero checks 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 is suitable for most projects.
The selected Node.js version and image are displayed at the top of your deployment output, so you always know what is running:
Language : nodejs 24
Base image : node:24-slim
Version ranges give you the latest release in a series
Specifying a range such as 24.x, >=24.5.0, or ^24.0.0 ensures you always get the latest available 24.x release. This way, you benefit from every security fix and update in that line, without any manual action.
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 correspond to a specific installable release. In such cases, Stackhero moves on to the next version source in the list. Your deployment output will clearly indicate if this happens.
A version number is all you need:
24
Staying on the LTS line
When no version is pinned, each deployment uses the current LTS release. This means you automatically receive all major, minor, and security updates as soon as they are published. Your deployment output will notify 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 routed to it. If your application is not compatible with a new major version, the previous version will continue to serve your users without interruption.
If you prefer to control your 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 specify 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 will be reported before the build starts, and your running application will not be 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 usually resolves the issue.