From 3ec281d1041d4b6ac76d363a81ab1cacd79fb869 Mon Sep 17 00:00:00 2001 From: Adam Lovatt Date: Wed, 23 Sep 2020 14:41:14 -0600 Subject: [PATCH] Ensure support for yarn v2 (#2379) --- install/libvips.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/install/libvips.js b/install/libvips.js index 2d2ac3ee..c641dec8 100644 --- a/install/libvips.js +++ b/install/libvips.js @@ -80,9 +80,12 @@ try { throw new Error(`Use with glibc ${detectLibc.version} requires manual installation of libvips >= ${minimumLibvipsVersion}`); } } - 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}`); + + const supportedNodeVersion = process.env.npm_package_engines_node || require('../package.json').engines.node; + if (!semver.satisfies(process.versions.node, supportedNodeVersion)) { + throw new Error(`Expected Node.js version ${supportedNodeVersion} but found ${process.versions.node}`); } + // Download to per-process temporary file const tarFilename = ['libvips', minimumLibvipsVersion, platformAndArch].join('-') + '.tar.br'; const tarPathCache = path.join(libvips.cachePath(), tarFilename);