Honestly, I'm unsure if this is a yarn 2.X issue, or an issue here, but here's what I'm seeing:
sharp-v0.26.1 added this semver check snippet for checking the current npm version:
if (!semver.satisfies(process.versions.node, process.env.npm_package_engines_node)) {
throw new Error(`Expected Node.js version ${process.env.npm_package_engines_node} but found ${process.versions.node}`);
}
https://github.com/lovell/sharp/blob/master/install/libvips.js#L83
Yarn v1.22.4 works perfectly with this and installs with no issues:
mkdir yarn1 && cd yarn1
yarn init -y
yarn add sharp
Yarn v2.2.2 runs into issues:
mkdir yarn2 && cd yarn2
yarn init -y
yarn set version berry
yarn add sharp
The error log includes this line:
ERR! sharp Expected Node.js version undefined but found 12.18.3
because npm_package_engines_node is undefined.
The following does work:
npm_package_engines_node=v12.18.3 yarn install
I'm also following up on the yarn discord to see if I can find any advice there. I'll update this if I find an answer from them or a better workaround.
This has just been fixed via #2379 and will be in the next release.
Oh perfect! Thanks much.
@lovell I was about to create a PR but noticed this is already fixed 3 weeks ago.
When can we expect sharp 0.26.2 to be released? Thanks!
v0.26.2 now available.
Most helpful comment
v0.26.2 now available.