I'm changing a node setup from node 14 x64
to node 14 arm64
in an Amazon ECR (Docker) entry.
It build with no problem when I use this image: FROM aws/lambda/nodejs:14
and this command to install sharp RUN npm install --platform=linux sharp
Now I need to use Node 14 arm64
image, but it launches this error while building with Sharp JS (Linux arm 64):
Dockerfile:
FROM public.ecr.aws/lambda/nodejs:14-arm64
# Exec commands
COPY index.js package.json ${LAMBDA_TASK_ROOT}
COPY fonts ${LAMBDA_TASK_ROOT}/fonts/
COPY src ${LAMBDA_TASK_ROOT}/src/
# Commands
RUN npm cache clean --force
RUN rm -rf node_modules
RUN npm install --arch=arm64 --platform=linux sharp
CMD ["index.handler"]
Build command:
docker build -t my-project-v1 .
docker tag my-project-v1:latest {ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/my-project-v1:latest
docker push {ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/my-project-v1:latest
Error:
=> ERROR [6/8] RUN npm install 7.3s
------
> [6/8] RUN npm install:
#10 2.231 npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
#10 2.249 npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
#10 6.947
#10 6.947 > [email protected] install /var/task/node_modules/sharp
#10 6.947 > (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
#10 6.947
#10 7.046 sharp: Installation error: Use with glibc 2.26 requires manual installation of libvips >= 8.11.3
#10 7.046 sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
#10 7.172 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
#10 7.173 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})
#10 7.174
#10 7.234 npm ERR! code ELIFECYCLE
#10 7.235 npm ERR! errno 1
#10 7.242 npm ERR! [email protected] install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)`
#10 7.242 npm ERR! Exit status 1
#10 7.243 npm ERR!
#10 7.244 npm ERR! Failed at the [email protected] install script.
#10 7.244 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
#10 7.261
#10 7.262 npm ERR! A complete log of this run can be found in:
#10 7.262 npm ERR! /root/.npm/_logs/2022-01-10T13_28_10_709Z-debug.lo