rsmbl / Resemble.js

Image analysis and comparison

Home Page:http://rsmbl.github.io/Resemble.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Avoid installing canvas

Llorx opened this issue · comments

Hi,

Simply, I just want the javascript part for webpack. Not interested into canvas. Is there a way to npm install resemble.js without canvas? Would like to have the version manager npm has instead of just pulling the javascript from here.

I have the same issue, today my build-pipeline broke, because of some node-gyp python error. (I still need to look into this)

Then I realized, node-gyp is used to compile the canvas module. But I was sure there is no image manipulation/analysis in my node code. But I include resemblejs from the package into an HTML-Rreport I generate. The report works fine (the browser knows canvas).

There are different solutions:

  1. Make canvas a development dependency. Build and unit tests should still work. But one would not be able to use resemblejs in node.
  2. Make canvas a peer dependency. It is up to the user to install canvas and therefore to support nodejs. But this will most-likely break tests and build.
  3. Make canvas a peer and development dependency (not sure if that works)

I think it would be too much trouble to fork this package, just to have a browser-only version.

On the other hand: What about bower? Does the bower package include the canvas dependency? I never really used bower because I felt I could do the same stuff (and more) with npm.

I'd like to see the Node and Browser capabilities split into seperate packages, with a mono-repo setup (Yarn workspaces perhaps). Bower is effectively deprecated, best to stick with NPM/Yarn, but yes, it'll not have any Node.js dependencies.

Having the same issue, pipelines fails because of some node-gyp python error after I installed codeceptjs-resemblehelper

Node-Canvas is now an optional dependency. Your options are to run npm ci --no-optional or npm ci --build-from-source in CI

@jamescryer is there a way not to install the canvas that is needed for browser only? As you said above we can skip node-canvas which is needed for node usage, but I have an opposite case