Node v20.17.0 is incompatible with "undici@7.14.0" | From Wrangler

Solved: - Add env var NODE_VERSION=22 Or - Remove wrangler package pnpm remove wrangler Attempting to build on Cloudflare Workers fails because of local wrangler version? Brought in from wrangler:
$ pnpm why undici

devDependencies:
wrangler 4.42.0
└─┬ miniflare 4.20251001.0
└── undici 7.14.0
$ pnpm why undici

devDependencies:
wrangler 4.42.0
└─┬ miniflare 4.20251001.0
└── undici 7.14.0
Build log:
16:11:50.810 Initializing build environment...
16:11:50.810 Initializing build environment...
16:11:58.340 Success: Finished initializing build environment
16:11:59.134 Cloning repository...
16:12:03.316 Detected the following tools from environment: nodejs@20.17.0, pnpm@10.15.1
16:12:03.316 Installing nodejs 20.17.0
16:12:17.415 Installing project dependencies: pnpm install --frozen-lockfile
16:12:18.113 Lockfile is up to date, resolution step is skipped
16:12:18.480  ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)
16:12:18.481
16:12:18.481 Your Node version is incompatible with "undici@7.14.0".
16:12:18.481
16:12:18.481 Expected version: >=20.18.1
16:12:18.481 Got: v20.17.0
16:12:18.481
16:12:18.481 This is happening because the package's manifest has an engines.node field specified.
16:12:18.481 To fix this issue, install the required Node version.
16:12:18.515 Failed: error occurred while installing tools or dependencies
16:11:50.810 Initializing build environment...
16:11:50.810 Initializing build environment...
16:11:58.340 Success: Finished initializing build environment
16:11:59.134 Cloning repository...
16:12:03.316 Detected the following tools from environment: nodejs@20.17.0, pnpm@10.15.1
16:12:03.316 Installing nodejs 20.17.0
16:12:17.415 Installing project dependencies: pnpm install --frozen-lockfile
16:12:18.113 Lockfile is up to date, resolution step is skipped
16:12:18.480  ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)
16:12:18.481
16:12:18.481 Your Node version is incompatible with "undici@7.14.0".
16:12:18.481
16:12:18.481 Expected version: >=20.18.1
16:12:18.481 Got: v20.17.0
16:12:18.481
16:12:18.481 This is happening because the package's manifest has an engines.node field specified.
16:12:18.481 To fix this issue, install the required Node version.
16:12:18.515 Failed: error occurred while installing tools or dependencies
Question: Is node@20.17.0 the only version we can build with on Cloudflare?
2 Replies
James
James2mo ago
You can set the NODE_VERSION env var to something like 22 to get a newer version
ZeddBread🐣
ZeddBread🐣OP2mo ago
Broooo Do you know how long I've been looking for a way to use a specific node version? Tysm!!

Did you find this page helpful?