question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to handle errors arising from Canvas compilation?

See original GitHub issue

I get errors trying to add vega-embed to my project on mac osx 10.13 (high sierra)

Anyone have any ideas?

Chads-MBP:kinetix-ui chadbr$ yarn add vega-embed
yarn add v1.0.0
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
warning object-keys@0.4.0: 
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
warning "@angular/flex-layout@2.0.0-rc.1" has incorrect peer dependency "@angular/common@^2.2.3".
warning "@angular/flex-layout@2.0.0-rc.1" has incorrect peer dependency "@angular/core@^2.2.3".
warning "@angular/flex-layout@2.0.0-rc.1" has incorrect peer dependency "zone.js@^0.7.2".
warning "@ngtools/webpack@1.5.5" has incorrect peer dependency "enhanced-resolve@^3.1.0".
warning "@ngtools/webpack@1.5.5" has incorrect peer dependency "webpack@^2.2.0 || ^3.0.0".
warning "extract-text-webpack-plugin@2.1.2" has incorrect peer dependency "webpack@^2.2.0".
warning "html-webpack-plugin@2.30.1" has incorrect peer dependency "webpack@1 || ^2 || ^2.1.0-beta || ^2.2.0-rc || ^3".
warning "less-loader@4.0.5" has incorrect peer dependency "less@^2.3.1".
warning "less-loader@4.0.5" has incorrect peer dependency "webpack@^2.0.0 || ^3.0.0".
warning "sass-loader@6.0.6" has incorrect peer dependency "node-sass@^4.0.0".
warning "sass-loader@6.0.6" has incorrect peer dependency "webpack@^2.0.0 || >= 3.0.0-rc.0 || ^3.0.0".
warning "stylus-loader@3.0.1" has incorrect peer dependency "stylus@>=0.52.4".
warning "url-loader@0.5.9" has incorrect peer dependency "file-loader@*".
warning "webpack-dev-middleware@1.12.0" has incorrect peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
warning "webpack-dev-server@2.4.5" has incorrect peer dependency "webpack@^2.2.0".
warning "ajv-keywords@1.5.1" has incorrect peer dependency "ajv@>=4.10.0".
[5/5] πŸ“ƒ  Building fresh packages...
[1/2] β   canvas: '-Goutput_dir=.' ]
[2/2] β   canvas-prebuilt: node-pre-gyp http GET https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.0/canvas-prebuil
[-/2] β   waiting...
[-/2] β   waiting...
warning Error running install script for optional dependency: "/Users/chadbr/dev/vsts/kinetix-
ui/node_modules/canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: 
\nDirectory: /Users/chadbr/dev/vsts/kinetix-ui/node_modules/canvas\nOutput:\ngyp info it worked if 
it ends with ok\ngyp info using node-gyp@3.6.2\ngyp info using node@8.7.0 | darwin | x64\ngyp 
info spawn /Library/Frameworks/Python.framework/Versions/2.7/bin/python2\ngyp info spawn args [ 
'/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',\ngyp info spawn args   
'binding.gyp',\ngyp info spawn args   '-f',\ngyp info spawn args   'make',\ngyp info spawn args   '-
I',\ngyp info spawn args   '/Users/chadbr/dev/vsts/kinetix-
ui/node_modules/canvas/build/config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   
'/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args   '-
I',\ngyp info spawn args   '/Users/chadbr/.node-gyp/8.7.0/include/node/common.gypi',\ngyp info 
spawn args   '-Dlibrary=shared_library',\ngyp info spawn args   '-Dvisibility=default',\ngyp info 
spawn args   '-Dnode_root_dir=/Users/chadbr/.node-gyp/8.7.0',\ngyp info spawn args   '-
Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args   
'-Dnode_lib_file=/Users/chadbr/.node-gyp/8.7.0/<(target_arch)/node.lib',\ngyp info spawn args   '-
Dmodule_root_dir=/Users/chadbr/dev/vsts/kinetix-ui/node_modules/canvas',\ngyp info spawn args   
'-Dnode_engine=v8',\ngyp info spawn args   '--depth=.',\ngyp info spawn args   '--no-parallel',\ngyp 
info spawn args   '--generator-output',\ngyp info spawn args   'build',\ngyp info spawn args   '-
Goutput_dir=.' ]\n./util/has_lib.sh: line 31: pkg-config: command not found\ngyp: Call to 
'./util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load 
binding.gyp\ngyp ERR! configure error \ngyp ERR! stack Error: `gyp` failed with exit code: 1\ngyp 
ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-
gyp/lib/configure.js:336:16)\ngyp ERR! stack     at emitTwo (events.js:125:13)\ngyp ERR! stack     at 
ChildProcess.emit (events.js:213:7)\ngyp ERR! stack     at Process.ChildProcess._handle.onexit 
(internal/child_process.js:200:12success Saved lockfile.
success Saved 78 new dependencies.
β”œβ”€ brfs@1.4.3
β”œβ”€ buffer-equal@0.0.1
β”œβ”€ canvas-prebuilt@1.6.0
β”œβ”€ compare-versions@3.1.0
β”œβ”€ d3-array@1.2.1
β”œβ”€ d3-collection@1.0.4
β”œβ”€ d3-color@1.0.3
β”œβ”€ d3-contour@1.1.1
β”œβ”€ d3-dispatch@1.0.3
β”œβ”€ d3-dsv@1.0.7
β”œβ”€ d3-force@1.1.0
β”œβ”€ d3-format@1.2.0
β”œβ”€ d3-geo-projection@0.2.16
β”œβ”€ d3-geo@1.9.0
β”œβ”€ d3-hierarchy@1.1.5
β”œβ”€ d3-interpolate@1.1.5
β”œβ”€ d3-path@1.0.5
β”œβ”€ d3-quadtree@1.0.3
β”œβ”€ d3-queue@2.0.3
β”œβ”€ d3-request@1.0.6
β”œβ”€ d3-scale-chromatic@1.1.1
β”œβ”€ d3-scale@1.0.6
β”œβ”€ d3-selection@1.1.0
β”œβ”€ d3-shape@1.2.0
β”œβ”€ d3-time-format@2.1.0
β”œβ”€ d3-time@1.0.7
β”œβ”€ d3-timer@1.0.7
β”œβ”€ d3-voronoi@1.1.2
β”œβ”€ d3@3.5.17
β”œβ”€ escodegen@1.3.3
β”œβ”€ estraverse@1.5.1
β”œβ”€ falafel@2.1.0
β”œβ”€ foreach@2.0.5
β”œβ”€ get-stream@3.0.0
β”œβ”€ locate-path@2.0.0
β”œβ”€ mem@1.1.0
β”œβ”€ object-inspect@0.4.0
β”œβ”€ object-keys@0.4.0
β”œβ”€ p-finally@1.0.0
β”œβ”€ p-limit@1.1.0
β”œβ”€ p-locate@2.0.0
β”œβ”€ quote-stream@1.0.2
β”œβ”€ rw@1.3.3
β”œβ”€ shallow-copy@0.0.1
β”œβ”€ shapefile@0.3.1
β”œβ”€ shebang-command@1.2.0
β”œβ”€ shebang-regex@1.0.0
β”œβ”€ static-eval@0.2.4
β”œβ”€ static-module@1.5.0
β”œβ”€ through2@0.4.2
β”œβ”€ topojson@1.6.27
β”œβ”€ vega-crossfilter@2.0.0
β”œβ”€ vega-dataflow@3.0.3
β”œβ”€ vega-datasets@1.10.0
β”œβ”€ vega-embed@3.0.0-beta.20
β”œβ”€ vega-encode@2.0.4
β”œβ”€ vega-event-selector@2.0.0
β”œβ”€ vega-expression@2.3.1
β”œβ”€ vega-force@2.0.0
β”œβ”€ vega-geo@2.1.1
β”œβ”€ vega-hierarchy@2.1.0
β”œβ”€ vega-lite@2.0.0-rc4
β”œβ”€ vega-loader@2.0.2
β”œβ”€ vega-parser@2.3.0
β”œβ”€ vega-projection@1.0.0
β”œβ”€ vega-runtime@2.0.0
β”œβ”€ vega-scale@2.1.0
β”œβ”€ vega-scenegraph@2.0.4
β”œβ”€ vega-schema-url-parser@1.0.0-beta.3
β”œβ”€ vega-statistics@1.2.1
β”œβ”€ vega-transforms@1.1.1
β”œβ”€ vega-util@1.6.0
β”œβ”€ vega-view-transforms@1.1.0
β”œβ”€ vega-view@2.0.3
β”œβ”€ vega-voronoi@2.0.0
β”œβ”€ vega-wordcloud@2.0.2
β”œβ”€ vega@3.0.6
└─ xmlhttprequest@1.8.0
✨  Done in 15.24s.
Chads-MBP:kinetix-ui chadbr$ 

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
chadbrcommented, Oct 20, 2017

hurrah! and good golly –

This fixed it:

brew install pkg-config cairo libpng jpeg giflib

I found that in the canvas-prebuilt/canvas readme…

that’s a long road… πŸ˜•

is it really needed if it’s an optional install?

Thanks - Chad

0reactions
jheercommented, Oct 20, 2017

Canvas is β€œoptional” in the sense that Vega can run without it.

However, Canvas is used to compute font metrics. If it is not available, Vega falls back on some approximations that in some cases can lead to different bounding box and downstream layout calculations…

Various users over the years requested that it be made optional to enable graceful degradation when canvas installation fails, or when one is only concerned about browser deployment (at which point HTML canvas is available).

In any case, I’m glad you found the solution!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Power Apps Patch Function Error Handling - Matthew Devaney
First, we use the Errors function to check if there were any problems during the latest patch. Errors outputs a table so we'll...
Read more >
Node Canvas throwing error when running project
If that fails, go to node_modules/canvas and run npm install --build-from-source , which will compile the C++ addon and output the corect canvas...
Read more >
Introduction to Error Handling - Make
Basics Β· Error handler route Β· To add an error handler route to a module (let us call it Module X), right-click (or...
Read more >
Errors - discord.js Guide
JavaScript errors are thrown by node itself or by discord.js. These errors can easily be fixed by looking at the type of error...
Read more >
C++ Exceptions - W3Schools
Example. try { // Block of code to try throw exception; // Throw an exception when a problem arise } catch () {...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found