Closed hayesall closed 5 years ago
This will be resolved in the next build, which drops support for canvas 1.x and adds support for 2.5.0. If you want to live dangerously, you can install the alpha:
yarn add trianglify@next
# or
npm install --save trianglify@next
Summary
I did a fresh install of
cairo
+canvas
+trianglify
on MacOS, then ran into an error withrender_png
.This might be an issue with changes in the 2.0 release of
canvas
, since installingcanvas@1.6.13
instead ofcanvas@2.5.0
seemed to resolve it.Steps to Reproduce
The
examples/save-as-png.js
should be enough to reproduce this.Error Trace
```javascript /Users/hayesall/Desktop/example/node_modules/trianglify/lib/pattern.js:54 ctx.canvas.width = opts.width; ^ TypeError: Cannot read property 'canvas' of undefined at render_canvas (/Users/hayesall/Desktop/example/node_modules/trianglify/lib/pattern.js:54:9) at Object.render_png [as png] (/Users/hayesall/Desktop/example/node_modules/trianglify/lib/pattern.js:74:12) at Object.Short-term solution
Setting a hard dependency to
canvas@1.6.13
might be suitable to resolving this. The following seems to resolve this error: