question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install sharp on M1 Mac with Debian Stretch based Docker container

See original GitHub issue

Did 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:closed
  • Created 2 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

10reactions
lovellcommented, Oct 11, 2021

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

2reactions
rlvk-vkcommented, Feb 1, 2022

Changing from FROM node:16 to FROM node:16-bullseye as the first line in Dockerfile did the trick for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot install sharp with Docker on M1 Mac - Stack Overflow
I ensured that sharp version is 0.29. 0 , as well as installed lipvips globally on the Mac with brew install vips however...
Read more >
My Docker Setup for Gatsby | Walter Teng
How I get the development environment for my Gatsby site up and running on ... Cannot install sharp on M1 Mac with Debian...
Read more >
Installation | mediapipe - Google
Install OpenCV and FFmpeg. Option 1. Use package manager tool to install the pre-compiled OpenCV libraries. FFmpeg will be installed via libopencv-video-dev ....
Read more >
Untitled
FROM --platform=linux/aarch64 debian:stretch seems to do the same thing, and doesn't force running an aarch64 version of debian:stretch.
Read more >
.NET by Microsoft | Docker Hub
About · C# is simple, powerful, type-safe, and object-oriented while retaining the expressiveness and elegance of C-style languages. Anyone familiar with C and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found