Giter VIP home page Giter VIP logo

Comments (7)

lindapaiste avatar lindapaiste commented on June 16, 2024 1

Well this seems like a real nightmare.
Automattic/node-canvas#1733 (comment)
https://github.com/Automattic/node-canvas?tab=readme-ov-file#installation
Automattic/node-canvas#2186

The canvas package is used as a polyfill for running tests in jest-dom which involve <canvas> elements. Maybe there is a better alternative.

from ml5-next-gen.

OrpheasK avatar OrpheasK commented on June 16, 2024

Got the same error on a MacBook M1 running 13.5.2 while bringing in the current package.json to update an older branch. Took out the canvas dependency and it seems to be what is causing the issue, maybe a MacOS incompatibility? Examples can still run through yarn start unaffected.

from ml5-next-gen.

ziyuan-linn avatar ziyuan-linn commented on June 16, 2024

I tried a few things in those threads but none seems to work for me. Though someone did mention an alternative that supports both Intel and ARM chips: https://www.npmjs.com/package/@napi-rs/canvas.

from ml5-next-gen.

shiffman avatar shiffman commented on June 16, 2024

Ah, I've actually worked quite a bit with node-canvas and have all the proper dependencies on my machine installed and have no issues running yarn. I could imagine this being a roadblock for others and I agree it would be good to remove this dependency! I believe I installed the required dependencies with brew using the command here:

https://github.com/Automattic/node-canvas/wiki/Installation:-Mac-OS-X

@lindapaiste is there a way to temporarily remove the tests that require this and revisit later or will that cause other problems?

from ml5-next-gen.

lindapaiste avatar lindapaiste commented on June 16, 2024

@shiffman I'll take a look.

from ml5-next-gen.

lindapaiste avatar lindapaiste commented on June 16, 2024

Without this package we cannot run end-to-end tests where we provide the model with an actual image and check that we got the correct result. So that's a bummer. But....even with this package I was still running into a lot of other problems with using browser code in Node. I think that our long term plan might be that we do certain end-to-end tests in a browser environment instead of trying to polyfill everything. We would use Jest for unit tests of specific logic.

The bodypose tests will fail when removing canvas. The handpose tests already fail so no loss there. The tests for handleOptions are fine as that does not involve any image processing.

from ml5-next-gen.

shiffman avatar shiffman commented on June 16, 2024

This makes sense to me, @lindapaiste what do you think about pulling out the canvas tests for now from jest and then incorporating browser-based tests a different way separately?

from ml5-next-gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.