Firebase functions "engines field ... not supported" (Node version) in CI
The functions runtime is chosen from the engines.node field in functions/package.json. If that field is missing, or names a Node version the platform no longer supports, the deploy is rejected.
What this error means
A functions deploy fails complaining the engines field is missing, or that the requested Node runtime (for example nodejs14) is no longer supported.
firebase
Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {"node": "18|20|22"}Common causes
A deprecated Node runtime
Older runtimes such as nodejs14 are decommissioned; a deploy targeting them is refused.
A missing engines field
Without engines.node, the CLI cannot choose a runtime and asks you to set one.
How to fix it
Set a supported Node version
- Set
engines.nodeto a supported major version. - Match the CI Node version to the same major so the build matches the runtime.
- Re-run the deploy.
functions/package.json
{
"engines": { "node": "20" }
}Pin the CI Node to match
Use the same Node major in CI so compiled output targets the deployed runtime.
.github/workflows/ci.yml
- uses: actions/setup-node@v4
with:
node-version: '20'How to prevent it
- Keep
engines.nodeon a supported major version. - Match the CI Node version to the functions runtime.
- Upgrade off decommissioned runtimes before they are removed.
Related guides
Firebase "functions predeploy error: Command terminated with non-zero exit code" in CIFix Firebase "functions predeploy error: Command terminated with non-zero exit code" in CI - a predeploy lint…
Firebase "Functions codebase could not be analyzed successfully" in CIFix Firebase "Error: Functions codebase could not be analyzed successfully" in CI - the CLI could not load yo…
Firebase "Container Healthcheck failed" (gen2 functions) in CIFix Firebase "Error: Container Healthcheck failed" for gen2 functions in CI - the deployed container did not…