TL;DR - no hapi module officially supports yarn. If you choose yarn as your installer, you are doing it at your own risk and things are likely to break every once in a while. This has been our policy from the day yarn was released.
The recent changes to all hapi core modules to require node >=8.12.0 has caused some issues for people using yarn instead of npm. While hapi does work with yarn in general, it is not officially supported. This issue was raised in the past and the decision was to only officially support npm. There are a few reasons:
As for changing the minimum required node version in the engines field of package.json, we do that on a routine basis every few months, usually around a big release effort. If you use npm, the engines field is used to generate warnings only, never blocking a release (this is true since npm v3). We do this because:
If you are using yarn and are now having issue with a conflict between the required node version (currently v8.12.0) and the one deployed on your environment, simply change your yarn install command to add the --ignore-engines options which will resolve it.
For people having issues, note that the --ignore-engines (with a trailing 's'!) option can be specified for the entire project through the use of a .yarnrc checked into your repository. Just put the following line inside:
--ignore-engines true
Thanks for the quick and thorough response @hueniverse. I raised an issue with yarn regarding the inconsistent behaviour.
One thing I'd point out though, it doesn't look like npm provides any warnings when you do an install and are using a lower node version. So if the sole reason for including the engines section is to encourage people using the latest version node, it's probably not terribly effective at the cost of inconveniencing (probably quite a few) yarn users.
adanilev$ yarn
yarn install v1.9.4
info No lockfile found.
[1/4] 馃攳 Resolving packages...
[2/4] 馃殮 Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=8.12.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
vs
adanilev$ npm i
npm notice created a lockfile as package-lock.json. You should commit this file.
added 2 packages and audited 2 packages in 2.587s
found 0 vulnerabilities
@adanilev I think you've talked me into dropping engines completely since it is basically documentation only.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Most helpful comment
@adanilev I think you've talked me into dropping engines completely since it is basically documentation only.