Automattic / Automattic/node-canvas

document is not defined (using browser.js version instead of canvas.node)

Open
#2,412 2 comments 0 reactions 0 assignees View on GitHub
Needs more info
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue or Feature
- [ ] If this is an issue with installation, I have read the [troubleshooting guide](https://github.com/Automattic/node-canvas/issues/1511).

For some reason I am unable to create a canvas on NodeJS because it keeps failing with the "document is not defined" error coming from the browser.js. I installed it using 'yarn add canvas' and expected it to work as expected.

## Steps to Reproduce

```js
import * as Canvas from 'canvas'
var canvas = Canvas.createCanvas(200, 200);

```

## Your Environment
* Version of node-canvas (output of `npm list canvas` or `yarn list canvas`): 2.11.2
* Environment (e.g. node 20.9.0 on macOS 14.1.1): node 20.10.0 on macOS 14.0. Used in a API App Route on a NextJS website

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.