trekhleb / trekhleb/javascript-algorithms

Error: node-canvas was built without JPEG support

Open
#757 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
197k
Forks
31k
PR merge metrics
No merged PRs in 30d

Description

This error occurd when I was running the file

src/algorithms/image-processing/seam-carving/tests/resizeImageWidth.test.js

at Object.<anonymous> (~/javascript-algorithms-master/src/algorithms/image-processing/seam-carving/__tests__/resizeImageWidth.test.js:45:7)

describe('resizeImageWidth', () => {
  it('should perform content-aware image width reduction', () => {
    // @see: https://jestjs.io/docs/asynchronous
    return Promise.all([
      loadImage(testImageBeforePath), // ERROR at this line !!!
      loadImage(testImageAfterPath),
    ]).then(([imgBefore, imgAfter]) => {
      // Original image.
      // ...
    });
  });
});

Do I need to reinstall canvas?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/algorithms/image-processing/seam-carving/tests/resizeImageWidth.test.js, especially the loadImage call at line 45. Reproduce the failure and inspect how node-canvas is installed and configured for JPEG support. Done means the test runs without the reported JPEG-support error, or the required setup is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.