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:
Lovell Fuller
2023-10-08 15:38:59 +01:00
parent 51e56f994c
commit f7da2e5970
9 changed files with 48 additions and 29 deletions

View File

@@ -8,6 +8,10 @@ Requires libvips v8.14.5
* Drop support for Node.js 14 and 16, now requires Node.js >= 18.17.0
* Prebuilt binaries distributed via npm registry and installed via package manager.
* Building from source requires dependency on `node-addon-api`.
* Remove `sharp.vendor`.
* Make `compression` option of `heif` mandatory to help reduce HEIF vs HEIC confusion.

View File

@@ -53,9 +53,15 @@ This module will be compiled from source at `npm install` time when:
Building from source requires:
* C++11 compiler
* [node-addon-api](https://www.npmjs.com/package/node-addon-api)
* [node-gyp](https://github.com/nodejs/node-gyp#installation) and its dependencies
If `node-gyp` cannot be found, try adding it to `devDependencies`.
There is an install-time check for these dependencies.
If `node-addon-api` or `node-gyp` cannot be found, try adding them via:
```sh
npm install --save node-addon-api node-gyp
```
For cross-compiling, the `--platform`, `--arch` and `--libc` npm flags
(or the `npm_config_platform`, `npm_config_arch` and `npm_config_libc` environment variables)