Error: Can't resolve 'canvas'
See original GitHub issueBasic info:
- Node.js version: 11.5.0
- jsdom version: 16.4.0
- @angular/core 10.0.5
Minimal reproduction case
const { JSDOM } = require("jsdom");
const dom = new JSDOM(`<!DOCTYPE html><p>Hello world</p>`);
$ = require('jquery')(dom.window);
Issue faced:
I am trying to use jsdom to create window and document objects for my SSR angular project. however, I am experiencing this error. I am using the window to attempt to initialize the jQuery library as previously I kept getting a jQuery requires window error.
ERROR in ./node_modules/jsdom/lib/jsdom/utils.js
Module not found: Error: Can't resolve 'canvas' in '/Users/amanda/Documents/project/node_modules/jsdom/lib/jsdom'
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Cannot install canvas on npm - node.js - Stack Overflow
I used the command npm install --build-from-source canvas, please can I have help?
Read more >canvas - npm
11+ and are experiencing trouble when compiling, run the following command: xcode-select --install . Read more about the problem on Stack ...
Read more >webpack/webpack - Gitter
ERROR in ./app/js/lib/fabric.min.js Module not found: Error: Cannot resolve module 'canvas' in E:\Dropbox\projects\avp\app\js\lib @ .
Read more >Getting started with react and canvas via Konva
react-konva is a JavaScript library for drawing complex canvas graphics using ... ModuleNotFoundError: Module not found: Error: Can't resolve 'canvas' in ...
Read more >Canvas.node webpack isn't working with node-loader
I've discovered that npm install canvas actually in… ... 12:59:35 PM: Module not found: Can't resolve 'bufferutil' in '/opt/build/repo/node_modules/ws/lib'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
install canval
demo:https://github.com/crazyair/umi-dompurify-demo
no fix it