NODE_VERSION env variable ignored?

I’m trying to deploy a website on Cloudflare pages that requires node JS >=14. I read in the docs that I can set the NODE_VERSION env variable to choose a NodeJS version. However, whatever value I try, somehow Cloudflare pages still uses the default Node JS 12.18.0 version… Can anybody tell me what I’m doing wrong?

Build settings on the deployment page:


build log:

v12.18.0 is already installed.

I tried major version 16,17, and specific version 16.7.0 per this topic: Pages Node.js version - #3 by WalshyMVP but the build log keeps showing v12.18.0 is used…

1 Like

Have you set the env var in both the production and preview environments?

And can you double check there’s nothing weird in the env var name or value - spaces, newlines, etc. - sometimes deleting it and manually typing can help validate this.

Yes, I set the variable both in production and in preview. I should add I only tried deploying on the preview branch up to now.

I already checked if perhaps I prepended or appended a space or other character, but this is not the case… I will try again just to make sure.

PS: wow, fastest response ever. Kudos to you!

1 Like

Ok, issue solved… I also had the HUGO_VERSION env variable set - above the NODE_VERSION env variable. Apparently setting HUGO_VERSION first makes it so that NODE_VERSION is ignored?

Swapping the two env variables so that NODE_VERSION comes first fixes the issue…

1 Like