Skip to content

createCanvas is not a function #4

@baskeyx

Description

@baskeyx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions