Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Vue.js unit tests error Module not found: 'canvas' in amcharts4

When I execute the test with vue-cli-service, I imported a component that contain amcharts4 to spec file then run command vue-cli-service test:unit

I got the error Module not found: 'canvas' in '\node_modules@amcharts\amcharts4\node_modules\canvg\dist\node'

Console log

Error in ./node_modules/@amcharts/amcharts4/node_modules/canvg/dist/node/canvg.js

  Module not found: 'canvas' in 'E:\Project\...\node_modules\@amcharts\amcharts4\node_modules\canvg\dist\node'

Error in ./node_modules/jsdom/lib/jsdom/utils.js

  Module not found: 'canvas' in 'E:\Project\...\node_modules\jsdom\lib\jsdom'

 ERROR  mocha-webpack exited with code 1.

Setup.js

require('jsdom-global')(undefined, { url: 'https://localhost' });

global.localStorage = window.localStorage;

global.sessionStorage = window.sessionStorage;
window.Date = Date;

Please help me to resolve this issue!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!