mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Add warning if sharp bindings aren't built correctly (#1638)
This commit is contained in:
parent
0a3512d066
commit
2e0fbbb942
@ -7,7 +7,25 @@ const events = require('events');
|
|||||||
const is = require('./is');
|
const is = require('./is');
|
||||||
|
|
||||||
require('./libvips').hasVendoredLibvips();
|
require('./libvips').hasVendoredLibvips();
|
||||||
const sharp = require('bindings')('sharp.node');
|
|
||||||
|
let sharp;
|
||||||
|
|
||||||
|
try {
|
||||||
|
sharp = require('bindings')('sharp.node');
|
||||||
|
} catch (error) {
|
||||||
|
// Bail early if bindings aren't available
|
||||||
|
console.error(
|
||||||
|
`
|
||||||
|
"sharp" does not seem to have been built or installed correctly.
|
||||||
|
|
||||||
|
- Try to reinstall packages and look for errors during installation
|
||||||
|
- Consult "sharp" installation page at http://sharp.pixelplumbing.com/en/stable/install/
|
||||||
|
|
||||||
|
If neither of the above work, please open an issue in https://github.com/lovell/sharp/issues
|
||||||
|
`
|
||||||
|
);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
// Use NODE_DEBUG=sharp to enable libvips warnings
|
// Use NODE_DEBUG=sharp to enable libvips warnings
|
||||||
const debuglog = util.debuglog('sharp');
|
const debuglog = util.debuglog('sharp');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user