1

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.

3
  • Do you see a warning with wrong node version? Commented Oct 16 at 11:25
  • nope, not even a warning, yarn-v4 does not respect engines.node I believe :( Commented Oct 16 at 11:32
  • Yes, I remember this problem with yarn 2+ Commented Oct 16 at 13:25

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.