sharp: Can't install on linux/arm64 with docker node

Trying to run a simple Dockerfile to install node together with sharp on linux/arm64 fails.

FROM node:14-slim

RUN npm i detect-libc

RUN node -e "console.log('platform=' + process.platform);console.log('arch='+process.arch);console.log(require('detect-libc'))"

RUN npm i sharp

when ran on arm64 - it produces:

> [4/4] RUN npm i sharp:                                                                                                                                                                                     
#8 3.664                                                                                                                                                                                                      
#8 3.664 > sharp@0.26.3 install /node_modules/sharp                                                                                                                                                           
#8 3.664 > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)                                                                                 
#8 3.664                                                                                                                                                                                                      
#8 3.736 ERR! sharp Use with glibc 2.24 requires manual installation of libvips >= 8.10.0
#8 3.736 info sharp Attempting to build from source via node-gyp but this may fail due to the above error
#8 3.736 info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
#8 3.789 gyp ERR! find Python 

while the arch checks gives:

platform=linux
arch=arm64
{
  GLIBC: 'glibc',
  MUSL: 'musl',
  family: 'glibc',
  version: '2.24',
  method: 'getconf',
  isNonGlibcLinux: false
}

There are already prebuild libvips images for arm64v8 - why aren’t they used?

Running the same on Windows 10, goes actually just fine. While the arch checks is there pretty much the same:

Step 3/4 : RUN node -e "console.log('platform=' + process.platform);console.log('arch='+process.arch);console.log(require('detect-libc'))"
 ---> Running in 4c7db816aa17
platform=linux
arch=x64
{
  GLIBC: 'glibc',
  MUSL: 'musl',
  family: 'glibc',
  version: '2.24',
  method: 'getconf',
  isNonGlibcLinux: false
}
Removing intermediate container 4c7db816aa17
 ---> 68c8b2d9c3f4
Step 4/4 : RUN npm i sharp
 ---> Running in a617bbed12e4

> sharp@0.26.3 install /node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-linux-x64.tar.br

+ sharp@0.26.3
added 73 packages from 173 contributors and audited 74 packages in 7.417s

@lovell I think the glibc check is a bit too hard and doesn’t check for prebuild images first.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 7
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Btw the Linux/arm64 is running natively on the new Apple Silicon M1 arm64 with the upcoming Docker Desktop version for the M1.

So it is essential to have the right binaries ready for easy docker deploy @lovell

@lovell are the node-gyp checks already adjusted for the new live builds? I’m still getting errors of not found binaries. Also on the regular linux/arm64 - the gcc version check is still in place:

Using node-14:slim (GCC)

#13 19.60 npm ERR! path /opt/node_app/node_modules/sharp
#13 19.60 npm ERR! command failed
#13 19.60 npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
#13 19.60 npm ERR! ERR! sharp Use with glibc 2.24 requires manual installation of libvips >= 8.10.5
#13 19.60 npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error

and using node-14:alpine (MUSL)

#12 19.17 npm ERR! path /opt/node_app/node_modules/sharp
#12 19.17 npm ERR! command failed
#12 19.17 npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
#12 19.17 npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linuxmusl-arm64v8.tar.br
#12 19.17 npm ERR! ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for linuxmusl-arm64v8
#12 19.17 npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error

Please see https://github.com/lovell/sharp-libvips/commit/2e4202d671904666c012b142b8e21be017d30a28 for a discussion about why the prebuilt arm64 binaries currently require glibc 2.29+