Chart.js in Node.js¶
To render charts with Chart.js on Node.js, you’ll need the canvas package, which requires several system libraries to build.
Install system dependencies¶
Debian/Ubuntu¶
macOS¶
Requires: Homebrew
Dependency overview¶
| Library | Purpose |
|---|---|
| cairo | 2D graphics rendering |
| pango | Text rendering |
| libpng | PNG support |
| jpeg | JPEG support |
| giflib | GIF support |
| librsvg | SVG support (optional) |
| build tools (build-essential/pkg-config) | Compilers and flags management |
Managing the canvas package¶
- Rebuild
canvasif you encounter runtime errors, especially after dependency or environment changes.