disney/meteor-base

sharp: Installation error

Opened this issue · 1 comments

Hello,

Is there any way to install sharp properly.

Please see below the error message.

> sharp@0.28.3 install /opt/bundle/bundle/programs/server/npm/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)

sharp: Installation error: 'linux-x64' binaries cannot be used on the 'linuxmusl-x64' platform. Please remove the 'node_modules/sharp' directory and run 'npm install' on the 'linuxmusl-x64' platform.
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.28.3 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.28.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Thank you!

See https://github.com/disney/meteor-base/blob/master/example/app-with-native-dependencies.dockerfile. You can use that Dockerfile instead of the default one if Sharp will compile itself for Linux Alpine at install time.

If Sharp doesn’t compile for Alpine (or really for musl binaries) then change your Dockerfile’s FROM node:12.22.1-alpine line to FROM node:12.22.1 to use Ubuntu-based Node that has the other binaries, which is what Sharp is asking for in its error message. This will result in a larger image in the end, but it will work.