node-countdown-gif icon indicating copy to clipboard operation
node-countdown-gif copied to clipboard

createCanvas is not a function

Open baskeyx opened this issue 5 years ago • 3 comments

Hey, firstly I love this build and have managed to deploy it to Heroku!

I was looking at adding web fonts support and have been looking at the registerFont utility method. However if I tweak the code from:

const Canvas = require('canvas'); ........ this.canvas = new Canvas(this.width, this.height);

To either:

const Canvas = require('canvas'); ........ this.canvas = Canvas.createCanvas(this.width, this.height);

or:

const { createCanvas } = require('canvas'); ........ this.canvas = createCanvas(this.width, this.height);

I get an error telling me that createCanvas is not a function, the same if I add registerFont.

I'm using canvas 2.6.0 and node 11.8.0, any ideas?

Thanks,

Dan

baskeyx avatar Aug 22 '19 10:08 baskeyx

Any luck? I faced the same issue!

GingerDragon7 avatar Nov 19 '19 10:11 GingerDragon7

Hi @GingerDragon7,

Unfortunately not, I gave up and ended up using Arial (-_-). If you find a way around this keep me posted!

Thanks,

Dan

baskeyx avatar Nov 20 '19 09:11 baskeyx

Hi @GingerDragon7,

Unfortunately not, I gave up and ended up using Arial (-_-). If you find a way around this keep me posted!

Thanks,

Dan

https://github.com/Automattic/node-canvas/#registerfont

Shahzad6077 avatar Oct 01 '22 04:10 Shahzad6077