mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Ensure vendor platform mismatch throws error #1303
This commit is contained in:
parent
2de062a34a
commit
75556bb57c
@ -14,6 +14,9 @@ Requires libvips v8.6.1.
|
|||||||
[#1290](https://github.com/lovell/sharp/pull/1290)
|
[#1290](https://github.com/lovell/sharp/pull/1290)
|
||||||
[@sylvaindumont](https://github.com/sylvaindumont)
|
[@sylvaindumont](https://github.com/sylvaindumont)
|
||||||
|
|
||||||
|
* Ensure vendor platform mismatch throws error at install time.
|
||||||
|
[#1303](https://github.com/lovell/sharp/issues/1303)
|
||||||
|
|
||||||
#### v0.20.5 - 27<sup>th</sup> June 2018
|
#### v0.20.5 - 27<sup>th</sup> June 2018
|
||||||
|
|
||||||
* Expose libjpeg optimize_coding flag.
|
* Expose libjpeg optimize_coding flag.
|
||||||
|
@ -23,14 +23,17 @@ const globalLibvipsVersion = function () {
|
|||||||
|
|
||||||
const hasVendoredLibvips = function () {
|
const hasVendoredLibvips = function () {
|
||||||
const currentPlatformId = platform();
|
const currentPlatformId = platform();
|
||||||
|
let vendorPlatformId;
|
||||||
try {
|
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) {
|
if (currentPlatformId === vendorPlatformId) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} 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'.`);
|
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;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user