How can I override the npm version?
Hi, I know you can use the NODE_VERSION to change the node version but my build won't pass because it needs a certain npm version.
From the website, there's no environment variable listed for npm:https://developers.cloudflare.com/pages/configuration/language-support-and-tools/
The website also mentioned "We are aware of some outstanding issues with the v2 build system that we intend on fixing: Detecting Node.js and package managers from package.json -> "engines".
". I've tried specifying the npm version through package.json->"engines" but this is also not working.
Thank you!
Cloudflare Docs
Language support and tools · Cloudflare Pages docs
Cloudflare Pages’ build environment has broad support for a variety of languages, such as Ruby, Node.js, Python, PHP, and Go.
2 Replies
I think
.nvmrc
should do the trick. Example: https://github.com/survivejs/website-v3/blob/main/.nvmrc
That's the solution I'm using anyway to handle a similar issue.nvmrc override node version, not npm version.
For future reference, I was able to override npm version using v1 not v2 of the build system. v1 has both NPM_VERSION and NODE_VERSION as environment variables to override default version. This fixed my build issue.
Very interesting that v2 doesn't have feature parity of v1. Thank you for the reponse though!