Cannot install sharp on M1 Mac with Debian Stretch based Docker container
See original GitHub issueDid you see the documentation relating to installation? yes
Have you ensured the architecture and platform of Node.js used for npm install
is the same as the architecture and platform of Node.js used at runtime?
yes
Are you using the latest version? Is the version currently in use as reported by npm ls sharp
the same as the latest version as reported by npm view sharp dist-tags.latest
?
yes (0.29.0)
If you are using npm v6 or earlier and installing as a root
or sudo
user, have you tried with the npm install --unsafe-perm
flag?
n/a
If you are using npm v7, does the user running npm install
own the directory it is run in?
n/a
If you are using the ignore-scripts
feature of npm
, have you tried with the npm install --ignore-scripts=false
flag?
no
What is the complete output of running npm install --verbose sharp
? Have you checked this output for useful error messages?
What is the output of running npx envinfo --binaries --system
?
Issue occurs on M1 Mac when I try yarn install
dependencies (including sharp) on Docker. However it is fine when I yarn install
locally.
What I did is to ensure that I’m using latest sharp 0.29.0. I also installed libvips globally with homebrew. It all works fine if I just yarn install from terminal, however if I go to docker it fails with the following error. To my Dockerfile I also added apt-get libvips but this didn’t help.
Any suggestions?
OUTPUT ERROR
error /usr/src/app/node_modules/sharp: Command failed.
Exit code: 1
Command: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
Arguments:
Directory: /usr/src/app/node_modules/sharp
Output:
sharp: Installation error: Use with glibc 2.24 requires manual installation of libvips >= 8.11.3
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
ERROR: Service 'saas-api' failed to build : The command '/bin/sh -c yarn install --frozen-lockfile && yarn cache clean' returned a non-zero code: 1
DOCKERFILE
FROM node:14.17.3-stretch as install
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
imagemagick \
ghostscript \
libvips
WORKDIR /usr/src/app
RUN chown 1000:1000 .
USER node
COPY package.json ./
COPY yarn.lock ./
RUN yarn install --frozen-lockfile && yarn cache clean
COPY patches patches
RUN yarn patch-package
ARG version=dev
ENV VERSION=$version
FROM install as build
COPY . .
RUN yarn build
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (5 by maintainers)
I meant Debian Bullseye, not Buster, sorry. You could also try Alpine Linux. Eventually this will be solved via https://github.com/lovell/sharp-libvips/issues/114
Changing from
FROM node:16
toFROM node:16-bullseye
as the first line in Dockerfile did the trick for me