Wrong node version selected by vercel build

vercel build is choosing node 22 which causes my npm to fail based on the "engines": { "node": "^20.15.1", "npm": "^10.7.0" } in my package.json

I was a little confused where it was getting 22 from until I located the “project settings”. Once I updated those I can see that "nodeVersion": "20.x" is getting brought into my package.json correctly with vercel pull. But even after manually deleting the .vercel/output/builds.json it keeps being regenerated with "argv": ["/Users/<my user>/.volta/tools/image/node/22.14.0/bin/node",

What am I missing?

I thought maybe it was picking up on my local volta settings, but even after nuking node 22 and switching to a global default of 20 the vercel build seems to pick up 22 from somewhere.

Hi Kevin,

Can you tell us what version of CLI are you using? Do you have engines in your package.json?

Hi Swarnava I’m using Vercel CLI 42.3.0 and yes the project has an engines entry and .nvmrc v20.18.0

package.json

{
  "engines": {
    "node": "^20.15.1",
    "npm": "^10.7.0"
  },
  "volta": {
    "node": "20.19.2"
  },
}

We don’t guarantee minor and patch version so you should ideally set 20.x in your package.json. Either way, could you confirm what is the issue you are facing? Are you not seeing Node v20 is being used for builds?

a minor version problem would be fine, what was confusing here is that it’s choosing 22 for some reason, so then npm install fails due to the conflict with the engines entry.

When I check the node version locally I get 20 (because that’s how I have Volta configured) but invoking vercel build locally results in SOMETHING switching to node 22 and erroring.

➜  frontizo-status git:(main) ✗ node -v
v20.19.2
➜  frontizo-status git:(main) ✗ vercel build --token=$VERCEL_TOKEN
Vercel CLI 42.3.0
WARN! Build not running on Vercel. System environment variables will not be available.
Installing dependencies...
npm warn ERESOLVE overriding peer dependency
...
npm error code EBADENGINE
npm error engine Unsupported engine
npm error engine Not compatible with your version of node/npm: frontizo-status@1.0.0
npm error notsup Not compatible with your version of node/npm: frontizo-status@1.0.0
npm error notsup Required: {"node":"^20.15.1","npm":"^10.7.0"}
npm error notsup Actual:   {"npm":"10.9.2","node":"v22.14.0"}
npm error A complete log of this run can be found in: /Users/<my user>/.npm/_logs/2025-06-23T19_34_12_592Z-debug-0.log
Error: Command "npm install" exited with 1

I think your vercel package is reading node version from different Path, can you reproduce this with vercel deploy ?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.