'Assertion failed' error while using node-canvas

362 Views Asked by At

I want to use node-canvas and when I try to render text, I get this Error:

Assertion failed: (!scaled_font->cache_frozen), function _cairo_scaled_glyph_page_destroy, file cairo-scaled-font.c, line 459. Abort trap: 6

Here some sample code:

ctx.fillStyle = 'black'
ctx._setFont(Weight, Style, FontSize, 'px', 'Arial')
ctx.fillText("Hello, World!", 50, 50)

.fillText crashed all the time, with the same error.

Maybe it's a problem with cario. Not sure what's going wrong there.

My set up:

Mac OS 10.13.6, canvas@^2.0.0-alpha.17 and installed the packages via brew install pkg-config cairo pango libpng jpeg giflib librsvg.

I wrote some comment at github here: node-canvas

1

There are 1 best solutions below

0
On

I find this post on github. When i use node canvas-prebuilt it works for me. Then there is no problem with text rendering. It means installing canvas-prebuild with npm install canvas-prebuilt and load the module with require('canvas-prebuilt').