You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! stack Error: make failed with exit code: 2
64.81 .../canvas@3.2.0/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 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! System Linux 6.11.0-1018-azure
64.81 .../canvas@3.2.0/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 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! cwd /app/node_modules/.pnpm/canvas@3.2.0/node_modules/canvas
64.81 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! node -v v22.21.1
64.81 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! node-gyp -v v10.3.1
64.81 .../canvas@3.2.0/node_modules/canvas install: gyp ERR! not ok
64.81 .../canvas@3.2.0/node_modules/canvas install: Failed
64.83 ELIFECYCLE Command failed with exit code 1.
GitHub Actions Error:
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
Reacted by Rikus Louw, M. Burak Kalkan, Jonathan Havlicek, Benoît, João Lavoier and Jennifer
That's why I'm still facing the issue. Looks like it's canvas@3.2.0 version's issue.
I’m experiencing the same issue. The Dockerfile was building 3–4 days ago with no problems, and there haven’t been any code changes, but now it doesn’t build. It doesn’t make sense to me.
My canvas version is @2.11.2 and I'm facing the same issue. It was resolved by setting the CXXFLAGS variable, as @fralways suggested. I will subscribe to this issue to follow up on the definitive solution.
Activity
trolloks commentedon Dec 8, 2025
I have the exact docker setup - node:22-alpine, pnpm and also running Windows locally. I am also experiencing the exact same issue.
Update:
I got it to build by downgrading to the following version.
fahad-6sensehq commentedon Dec 8, 2025
@trolloks yes, canvas@3.0.1 works. But I'm using another package called "chartjs-node-canvas" which is using canvas@3.2.0 under the hood.
dependencies:
canvas 3.0.1
chartjs-node-canvas 5.0.0
└── canvas 3.2.0
That's why I'm still facing the issue. Looks like it's canvas@3.2.0 version's issue.
deryabilisim commentedon Dec 8, 2025
I’m experiencing the same issue. The Dockerfile was building 3–4 days ago with no problems, and there haven’t been any code changes, but now it doesn’t build. It doesn’t make sense to me.
fralways commentedon Dec 9, 2025
add
CXXFLAGSas a temp workaround to make it work:example:
old:
RUN yarn install --immutablenew:
RUN CXXFLAGS="-include cstdint" yarn install --immutablefix should come from canvas to handle new GCC
jmlavoier commentedon Dec 9, 2025
My canvas version is @2.11.2 and I'm facing the same issue. It was resolved by setting the
CXXFLAGSvariable, as @fralways suggested. I will subscribe to this issue to follow up on the definitive solution.fahad-6sensehq commentedon Dec 10, 2025
@fralways CXXFLAGS variable worked for canvas@3.2.0
Hope canvas officially resolve this issue soon.
Koyamie commentedon Dec 12, 2025
Same issue here, works fine with bullseye image but fails with alpine.
Fix compilation on GCC 15 by including <cstdint> (Fixes Automattic#2545)
Fix compilation on GCC 15 by including <cstdint> (Automattic#2545)
skooch commentedon Dec 16, 2025
This is due to C++ standard library changes in GCC 15. I have a pull request with a fix in #2546
Fix compilation on GCC 15 by including <cstdint> (#2545) (#2546)
chearon commentedon Jan 10, 2026
Fixed by #2546 which you can get by using version 3.2.1