I have this in package.json:
"engines": {
"node": ">=18.20.5"
},
But when trying to install (yarn install) using Node version 18.20.3 did not throw any errors, how can I enforce Node version? I am using Yarn 4.10.3. I think enableEnginesCheck is not supported (.yarnrc.yml) with Yarn v4.
engines is designed to show a warning, not throw an error. devEngines and engine-strict are NPM-specific options that aren't necessarily supported by other package managers
It's correct that Yarn Berry doesn't even provide a warning if engines constraint isn't satisfied. Fortunately, it has plugin architecture that allows to extend the functionality.
With this plugin:
yarn plugin import https://raw.githubusercontent.com/devoto13/yarn-plugin-engines/main/bundles/%40yarnpkg/plugin-engines.js
Or this plugin:
yarn plugin import https://raw.githubusercontent.com/Akryum/yarn-check-node/main/bundle/check-node-version.js