mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Enhancement to and changelog entry for #1638
Remove bindings dependency as this isn't really... required
This commit is contained in:
parent
2e0fbbb942
commit
687795c801
@ -10,6 +10,10 @@ Requires libvips v8.7.4.
|
||||
[#1601](https://github.com/lovell/sharp/pull/1601)
|
||||
[@Goues](https://github.com/Goues)
|
||||
|
||||
* Improve help messaging should `require("sharp")` fail.
|
||||
[#1638](https://github.com/lovell/sharp/pull/1638)
|
||||
[@sidharthachatterjee](https://github.com/sidharthachatterjee)
|
||||
|
||||
#### v0.22.0 - 18<sup>th</sup> March 2019
|
||||
|
||||
* Remove functions previously deprecated in v0.21.0:
|
||||
|
@ -9,22 +9,24 @@ const is = require('./is');
|
||||
require('./libvips').hasVendoredLibvips();
|
||||
|
||||
let sharp;
|
||||
|
||||
try {
|
||||
sharp = require('bindings')('sharp.node');
|
||||
} catch (error) {
|
||||
sharp = require('../build/Release/sharp.node');
|
||||
} catch (err) {
|
||||
// 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
|
||||
`
|
||||
const help = ['', 'Something went wrong installing the "sharp" module', '', err.message, ''];
|
||||
if (/NODE_MODULE_VERSION/.test(err.message)) {
|
||||
help.push('- Ensure the version of Node.js used at install time matches that used at runtime');
|
||||
} else if (/invalid ELF header/.test(err.message)) {
|
||||
help.push(`- Ensure "${process.platform}" is used at install time as well as runtime`);
|
||||
} else {
|
||||
help.push('- Remove the "node_modules/sharp" directory, run "npm install" and look for errors');
|
||||
}
|
||||
help.push(
|
||||
'- Consult the installation documentation at https://sharp.pixelplumbing.com/en/stable/install/',
|
||||
'- Search for this error at https://github.com/lovell/sharp/issues', ''
|
||||
);
|
||||
throw error;
|
||||
console.error(help.join('\n'));
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Use NODE_DEBUG=sharp to enable libvips warnings
|
||||
|
@ -93,7 +93,6 @@
|
||||
"vips"
|
||||
],
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"color": "^3.1.0",
|
||||
"detect-libc": "^1.0.3",
|
||||
"fs-copy-file-sync": "^1.1.1",
|
||||
|
Loading…
x
Reference in New Issue
Block a user