firebase deploy rejects the Node.js version in a Cloud Functions package.json
Detected node engine ... in package.json, which is not a supported version. Valid versions are ...Short answer
The Firebase CLI builds the runtime name straight from engines.node in package.json, so the value must be a plain version such as 22, and a version that Google has decommissioned is refused. A runtime field in firebase.json wins over package.json. Set one supported major version, then deploy the functions again.
Fix it fast
1Find out which cause you have
Print the two places that choose the runtime. The CLI reads firebase.json first, then engines.node in the functions package.json.
grep -n -A2 "engines" functions/package.json grep -n "runtime" firebase.json2Match what you see, then jump to its fix
- 1
The message names a value such as >=20 or 20.x after 'Detected node engine'engines.node is a range or a dotted version, not a plain major numberFix - 2
The message ends with a list of valid versions that does not include yours, for example 16The version was decommissioned and left the list of valid versionsFix - 3
Deploy or update is refused for a runtime that the CLI itself still accepts, such as Node.js 18, or a running function is disabledThe runtime's decommission date at Google Cloud has passedFix - 4
You changed engines.node, but the deploy still reports the old versionfirebase.json sets a runtime that overrides package.jsonFix - 5
`runtime` field is required but was not found in firebase.json or package.json.Neither engines.node nor runtime is setFix
- 1
What does the error look like?
Detected node engine ... in package.json, which is not a supported version. Valid versions are ...`runtime` field is required but was not found in firebase.json or package.json.
Cause 1 of 5
engines.node is a range or a dotted version, not a plain major number
1Check
The CLI does no range parsing. It prepends nodejs to whatever engines.node holds, so >=20 becomes nodejs>=20 and 20.x becomes nodejs20.x, and neither is a runtime name. The Firebase documentation writes the field as a major number in quotes.
grep -n -A2 "engines" functions/package.json2Fix
Write the major version as a plain string.
"engines": {
"node": "22"
}3Verify
Deploy only the functions and watch for the runtime message.
firebase deploy --only functionsConfirmed by raw.githubusercontent.com
Cause 2 of 5
The version was decommissioned and left the list of valid versions
1Check
The valid versions are the Node.js runtimes the CLI does not mark as decommissioned. In the CLI source, nodejs14 and nodejs16 are decommissioned, and the Firebase documentation says deployment with those versions is disabled.
node --version2Fix
Pick one of the versions the message lists, then update the code and its dependencies for that major version.
"engines": {
"node": "22"
}3Verify
Run the deploy again; it moves past the version check.
firebase deploy --only functionsConfirmed by raw.githubusercontent.com
Cause 3 of 5
The runtime's decommission date at Google Cloud has passed
1Check
Google Cloud lists decommission dates per runtime. After that date you can no longer create or update functions on it, and existing ones may be disabled. The table gives 2025-10-30 for nodejs18 and 2026-10-30 for nodejs20, and notes that dates can be delayed.
grep -rn "nodejs18\|nodejs20\|\"node\"" functions/package.json firebase.json2Fix
Move to a runtime with a later decommission date: the table lists nodejs22 and nodejs24, and the CLI source lists both as generally available. Change engines.node, test the functions locally, then deploy.
"engines": {
"node": "22"
}3Verify
The deploy completes without the version error.
firebase deploy --only functionsConfirmed by docs.cloud.google.com
Cause 4 of 5
firebase.json sets a runtime that overrides package.json
1Check
The Firebase documentation says the CLI prefers the runtime value in firebase.json over any version or range in package.json.
grep -n "runtime" firebase.json2Fix
Update the runtime in the functions section of firebase.json to match, or remove it and keep engines.node as the single source.
// inside the functions section of firebase.json
"runtime": "nodejs22"3Verify
Deploy again and confirm the runtime line in the output matches.
firebase deploy --only functionsConfirmed by firebase.google.com
Cause 5 of 5
Neither engines.node nor runtime is set
1Check
The CLI throws this when package.json has no engines.node and firebase.json has no runtime.
grep -c "engines" functions/package.json
grep -c "runtime" firebase.json2Fix
Add engines.node to functions/package.json, or a runtime to firebase.json.
"engines": {
"node": "22"
}3Verify
The deploy starts building the functions instead of stopping at the version check.
firebase deploy --only functionsConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Keep engines.node as a plain major version, and keep only one place (package.json or firebase.json) that sets the runtime.
- Put the deprecation and decommission dates of your runtime in your project's upgrade calendar, and move at least a few weeks before the later one.
- Run the same Node.js major locally as in engines, so errors from the move show up before deploy.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- SessionBirdAn omnichannel engagement suite in Flutter: campaigns, chatbot, tickets, analytics and live calling.
Related fixes
Back end
Firebase Cloud Functions respond slowly, especially on the first call
Every function in the project is slow after deploy, even tiny ones
Most slow first calls are cold starts: the runtime starts from scratch, loads your code and runs global-scope work before it can answer.
3 causes, each with a fixBack end
firebase-admin warns that FIREBASE_CONFIG is missing
Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail
Cloud Functions for Firebase sets FIREBASE_CONFIG for you; a script run with plain node does not have it.
3 causes, each with a fixBack end
firebase deploy --only functions fails with a generic deploy error
HTTP 429
The generic message hides a specific one.
3 causes, each with a fixBack end
firebase deploy cannot load the .env file in the functions folder
FirebaseError: Failed to load environment variables from .env
The CLI reads .env files from the functions folder at deploy time and rejects ones it cannot use.
3 causes, each with a fixBack end
firebase deploy cannot load your functions: user code failed to load
Functions codebase could not be analyzed successfully. It may have a syntax or runtime error
The Firebase CLI loads your functions code on your machine before it deploys, to learn which functions exist.
4 causes, each with a fixBack end
Firebase Functions fails to load because csv-parse/sync is missing
Cannot find module 'csv-parse'
Firebase installs only what the functions package.json lists under dependencies, and it ignores your local node_modules at deploy.
3 causes, each with a fix