mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Ensure vendor platform mismatch throws error #1303
This commit is contained in:
@@ -23,14 +23,17 @@ const globalLibvipsVersion = function () {
|
||||
|
||||
const hasVendoredLibvips = function () {
|
||||
const currentPlatformId = platform();
|
||||
let vendorPlatformId;
|
||||
try {
|
||||
const vendorPlatformId = require(path.join(__dirname, '..', 'vendor', 'platform.json'));
|
||||
vendorPlatformId = require(path.join(__dirname, '..', 'vendor', 'platform.json'));
|
||||
} catch (err) {}
|
||||
if (vendorPlatformId) {
|
||||
if (currentPlatformId === vendorPlatformId) {
|
||||
return true;
|
||||
} else {
|
||||
throw new Error(`'${vendorPlatformId}' binaries cannot be used on the '${currentPlatformId}' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.`);
|
||||
}
|
||||
} catch (err) {}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user