Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failed at the canvas@1.6.0 install script #104

Open
chill-fpraz opened this issue Jun 5, 2018 · 2 comments
Open

Install failed at the canvas@1.6.0 install script #104

chill-fpraz opened this issue Jun 5, 2018 · 2 comments

Comments

@chill-fpraz
Copy link

Posting this for anyone having the same issue. Since it's a local mac install, the dependency issues may not apply to other setups.

My Setup

  • Mac OS X 10.13.5
  • Xcode 9.4
  • Git 2.15.1
  • Node 10.3.0

Steps

Followed Mac OS X installation instructions in INSTALL.md (using Homebrew):

brew install pkg-config cairo pango libpng jpeg giflib ffmpeg
git clone https://github.com/nypublicradio/audiogram.git
cd audiogram
npm install

Received 15 warnings and 7 errors. Errors were for 'TryCatch' and 'HasOwnProperty' in /src/Canvas.cc:

error: no matching constructor for initialization of 'v8::TryCatch'
error: no matching member function for call to 'HasOwnProperty'

Upgraded to Canvas 2.0.0-alpha.12
npm install canvas@next

That fixed the install errors, but when running npm start and trying to generate mp4, rec'd this error:

TypeError: Canvas is not a constructor
    at drawFrames (/Applications/audiogram/audiogram/draw-frames.js:12:19)
    at /Applications/audiogram/audiogram/index.js:112:5
    at initializeCanvas (/Applications/audiogram/audiogram/initialize-canvas.js:12:12)
    at Audiogram.drawFrames (/Applications/audiogram/audiogram/index.js:104:3)
    at start (/Applications/audiogram/node_modules/d3-queue/build/d3-queue.js:74:11)
    at poke (/Applications/audiogram/node_modules/d3-queue/build/d3-queue.js:58:11)
    at /Applications/audiogram/node_modules/d3-queue/build/d3-queue.js:90:23
    at /Applications/audiogram/audiogram/index.js:61:14
    at Stream.<anonymous> (/Applications/audiogram/audiogram/waveform.js:27:12)
    at Stream.emit (events.js:182:13)

A Fix

Found this issue which identifies new function: Canvas.createCanvas()

In /audiogram/audiogram/draw-frames.js, changed line 12 from

canvases.push(new Canvas(options.width, options.height));
to
canvases.push(new Canvas.createCanvas(options.width, options.height));

Not sure if the code change above should be added as a pull request since it involves Canvas 2.x - maybe a version check could switch between the two?

@radeps
Copy link

radeps commented Aug 2, 2018

I created a github account just to say: thank you!

@sporkman
Copy link

sporkman commented Oct 7, 2019

Hi - could someone from WNYC update the instructions to include this:

npm install canvas@next

The default instructions failed on FreeBSD, so I went chasing around for that, then the OS-X instructions failed on OS-X so I installed Ubuntu in a VM and again, similar errors during the Canvas build.

After a few hours, I landed on this issue and I now have this running on all 3 OSes. If this info were in the README, it would have been super helpful!

theramiyer pushed a commit to theramiyer/audiogram that referenced this issue Apr 2, 2020
AymaneZizi added a commit to AymaneZizi/audiogram that referenced this issue Jun 6, 2020
as fix for issues nypublicradio#104 about canvas
also npm 'install canvas@next' should be run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants