mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Building from source now requires node-addon-api in dependencies
If you want to build sharp from source against a globally-installed libvips then you will now need to add both node-addon-api and node-gyp to the dependencies section of your package.json file. The binding.gyp file is "hidden" inside the src directory to prevent various build and package manager tooling from assuming that everyone is going to build from source every time.
This commit is contained in:
@@ -3,18 +3,27 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const { useGlobalLibvips, globalLibvipsVersion, log, gypRebuild } = require('../lib/libvips');
|
||||
const { useGlobalLibvips, globalLibvipsVersion, log, spawnRebuild } = require('../lib/libvips');
|
||||
|
||||
const buildFromSource = (msg) => {
|
||||
log(msg);
|
||||
log('Attempting to build from source via node-gyp');
|
||||
try {
|
||||
require('node-gyp');
|
||||
require('node-addon-api');
|
||||
log('Found node-addon-api');
|
||||
} catch (err) {
|
||||
log('You might need to install node-gyp');
|
||||
log('Please add node-addon-api to your dependencies');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const gyp = require('node-gyp');
|
||||
log(`Found node-gyp version ${gyp().version}`);
|
||||
} catch (err) {
|
||||
log('Please add node-gyp to your dependencies');
|
||||
return;
|
||||
}
|
||||
log('See https://sharp.pixelplumbing.com/install#building-from-source');
|
||||
const status = gypRebuild();
|
||||
const status = spawnRebuild();
|
||||
if (status !== 0) {
|
||||
process.exit(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user