CF-Incidents Workers - Pin your npm version in Workers Builds with packageManager

Cloudflare Service Informational Feeds

ENF News Bot

Automated News Bot
Joined
Apr 15, 2022
Messages
2,591
You can now choose the npm version that Workers Builds uses by setting the packageManager field in your package.json. Before the build installs dependencies, it installs the npm version you set, so a lockfile written by a newer npm version installs the same way in your build as it does locally.

package.jsonjson

Code:
{
	"packageManager": "npm@11.19.1"
}

The packageManager field also sets the version of Yarn, pnpm, and Bun. Use an exact version, such as npm@11.19.1, not a range. Workers Builds does not use the engines.npm field to choose an npm version.

For more information, refer to Package manager versions.

Continue reading...
 
Back
Top