Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Bundling sharp doesn't work anymore since updating to 4.5.0 #1075

@pkeuter

Description

@pkeuter

Since updating to version 4.5.0 it is not possible to bundle sharp anymore. Previously this was fairly simple, by just copying the node_modules/sharp folder next to the build output. But this doesn't work anymore giving the following error:

Error:
Something went wrong installing the "sharp" module

File '/**/test/node_modules/sharp/build/Release/libvips-cpp.so.42' was not included into executable at compilation stage. Please recompile adding it as asset or script.

- Remove the "node_modules/sharp" directory then run
  "npm install --ignore-scripts=false --verbose" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues

    at Object.<anonymous> (/snapshot/test/node_modules/sharp/lib/constructor.js:34:9)
    at Module._compile (pkg/prelude/bootstrap.js:1329:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1218:10)
    at Module.load (internal/modules/cjs/loader.js:1047:32)
    at Function.Module._load (internal/modules/cjs/loader.js:935:14)
    at Module.require (internal/modules/cjs/loader.js:1087:19)
    at Module.require (pkg/prelude/bootstrap.js:1234:31)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/snapshot/test/node_modules/sharp/lib/index.js:3:15)
    at Module._compile (pkg/prelude/bootstrap.js:1329:22)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1218:10)
    at Module.load (internal/modules/cjs/loader.js:1047:32)
    at Function.Module._load (internal/modules/cjs/loader.js:935:14)
    at Module.require (internal/modules/cjs/loader.js:1087:19)
    at Module.require (pkg/prelude/bootstrap.js:1234:31)
    at require (internal/modules/cjs/helpers.js:73:18)

I'm fairly convinced this has to do with #837 or #1066 or maybe a combination of both.

Looking at the below error message running in CI, it seems that prebuild-install is not correctly installed or referenced, this has been added in #1066:

> [email protected]
> Fetching base Node.js binaries to PKG_CACHE_PATH
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/build/Release
  %2: path-to-executable/sharp/build/Release
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/vendor/lib
  %2: path-to-executable/sharp/vendor/lib
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/build/Release
  %2: path-to-executable/sharp/build/Release
> Warning Cannot include directory %1 into executable.
  The directory must be distributed with executable as %2.
  %1: node_modules/sharp/vendor/lib
  %2: path-to-executable/sharp/vendor/lib
/bin/sh: 1: /builds/test/node_modules/pkg/node_modules/.bin/prebuild-install: not found
/bin/sh: 1: /builds/test/node_modules/pkg/node_modules/.bin/prebuild-install: not found

I'm mentioning both @david-mohr as well as @geekuillaume hoping they have a suggestion on how to fix this.

On a sidenote; this seems to me a breaking change so 5.0.0 would have been a more logical version for this release I suppose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions