Skip to content

Canvas install failed on docker. #2545

@fahad-6sensehq

Description

@fahad-6sensehq

In my NestJS app, I used canvas for exporting graphs from my system. Canvas work properly on my local machine (Windows). But when I try to dockerize it for AWS ECR, its failed. Facing with error form last week before that everything was fine. Is it node:22-apline issue or canvas issue?

How can I resolve this issue?

[deps 6/6] RUN pnpm install:
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! stack Error: make failed with exit code: 2
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:216:23)
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! System Linux 6.11.0-1018-azure
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! cwd /app/node_modules/.pnpm/[email protected]/node_modules/canvas
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! node -v v22.21.1
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! node-gyp -v v10.3.1
64.81 .../[email protected]/node_modules/canvas install: gyp ERR! not ok
64.81 .../[email protected]/node_modules/canvas install: Failed
64.83  ELIFECYCLE  Command failed with exit code 1.

GitHub Actions Error:

Image Image

My docker file:

FROM node:22-alpine AS deps
WORKDIR /app

RUN apk add --no-cache
python3
make
g++
pkgconfig
cairo-dev
pango-dev
jpeg-dev
giflib-dev
fontconfig
ttf-dejavu

RUN npm install -g pnpm@9

COPY package.json ./

RUN pnpm install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions