Suppose your package.json specifies a Node engine of greater than or equal 24. Does this mean all engineers on your team will use Node 24? No, unless you use this one weird trick!
Locally, the engines key of package.json is an advisory.
To force developers to use the same Node version, you can set the engine-strict flag. When true, such as through an .npmrc:
# .npmrc
engine-strict=true
You’ll get a nice error like this when you aren’t using a compatible Node:
$ npm install
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: bacon-docs@0.0.0
npm ERR! notsup Not compatible with your version of node/npm: bacon-docs@0.0.0
npm ERR! notsup Required: {"node":">=20.0"}
npm ERR! notsup Actual: {"npm":"8.19.4","node":"v16.20.2"}