Kibana: Compilation warning when running yarn install

Created on 17 Jan 2018  Β·  14Comments  Β·  Source: elastic/kibana

The canvas package is an optional-dependency of the vega-scenegraph package, which in turn is a dependency of vega, which Kibana relies on.

This message is basically spam. It has no impact on either the user or developer.

This is an upstream issue with vega.

warning Error running install script for optional dependency: "/Users/kim/dev/elastic/master/kibana/node_modules/canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: /Users/kim/dev/elastic/master/kibana/node_modules/canvas\nOutput:\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | darwin | x64\ngyp info spawn /usr/local/bin/python2\ngyp info spawn args [ '/Users/kim/.nvm/versions/node/v6.12.2/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/kim/dev/elastic/master/kibana/node_modules/canvas/build/config.gypi',\ngyp info spawn args '-I',\ngyp info spawn args '/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args '-I',\ngyp info spawn args '/Users/kim/.node-gyp/6.12.2/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/kim/.node-gyp/6.12.2',\ngyp info spawn args '-Dnode_gyp_dir=/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args '-Dnode_lib_file=node.lib',\ngyp info spawn args '-Dmodule_root_dir=/Users/kim/dev/elastic/master/kibana/node_modules/canvas',\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=.' ]\nPackage cairo was not found in the pkg-config search path.\nPerhaps you should add the directory containing cairo.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'cairo' 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 (/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)\ngyp ERR! stack at emitTwo (events.js:106:13)\ngyp ERR! stack at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack at Process.Chis

Visualizations bug

Most helpful comment

You can avoid this compilation error and suppress the warning by running either:

yarn install --ignore-scripts

or

npm install --no-optional

All 14 comments

You can avoid this compilation error and suppress the warning by running either:

yarn install --ignore-scripts

or

npm install --no-optional

Have we got a feel for if this will be prioritized? Doesn’t look like a big community (2 people with more than 3 commits the last 6 months, from what I can see). Would it be easy for us to contribute the necessary changes? I don’t know if you found out why stuff failed for @chrisronline yesterday, but if that error happens with others we need to consider doing something asap (Telling people to run yarn install --ignore-scripts is okey for a couple days, but it's not a solution).

@kjbekkelund yes, I think the real solution is indeed a fix from Vega. I can't speak to timing on their end.

The message is spam, just like the react-warnings, only longer. It only displays once, at the first install.

An interim solution is that we host our own pre-built vega without the canvas package, similar to how we host some other 3rd party libraries (e.g. numeral, ...) in a mirror. This would avoid the spam, and we can replace the dependency once Vega fixes the problem.

Hm, weird, I'm seeing it every time:

~/dev/elastic/master/kibana master*
❯ yarn
yarn install v1.3.2
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
[5/5] πŸ“ƒ  Building fresh packages...
[1/1] β ‚ canvas: spawn args   '-Goutput_dir=.' ]
[-/1] β ‚ waiting...
[-/1] β ‚ waiting...
[-/1] β ‚ waiting...
warning Error running install script for optional dependency: "/Users/kim/dev/elastic/master/kibana/node_modules/canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: /Users/kim/dev/elastic/master/kibana/node_modules/canvas\nOutput:\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | darwin | x64\ngyp info spawn /usr/local/bin/python2\ngyp info spawn args [ '/Users/kim/.nvm/versions/node/v6.12.2/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/kim/dev/elastic/master/kibana/node_modules/canvas/build/config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/Users/kim/.node-gyp/6.12.2/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/kim/.node-gyp/6.12.2',\ngyp info spawn args   '-Dnode_gyp_dir=/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=/Users/kim/dev/elastic/master/kibana/node_modules/canvas',\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=.' ]\nPackage cairo was not found in the pkg-config search path.\nPerhaps you should add the directory containing `cairo.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'cairo' 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 (/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack     at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack     at Process.Chisuccess Saved lockfile.
✨  Done in 11.93s.

~/dev/elastic/master/kibana master* 13s
❯ yarn
yarn install v1.3.2
[1/5] πŸ”  Validating package.json...
[2/5] πŸ”  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] πŸ”—  Linking dependencies...
warning " > [email protected]" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning " > [email protected]" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
[5/5] πŸ“ƒ  Building fresh packages...
[1/1] β ‚ canvas: info spawn args   '-Goutput_dir=.' ]
[-/1] β ‚ waiting...
[-/1] β ‚ waiting...
[-/1] β ‚ waiting...
warning Error running install script for optional dependency: "/Users/kim/dev/elastic/master/kibana/node_modules/canvas: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: /Users/kim/dev/elastic/master/kibana/node_modules/canvas\nOutput:\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | darwin | x64\ngyp info spawn /usr/local/bin/python2\ngyp info spawn args [ '/Users/kim/.nvm/versions/node/v6.12.2/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/kim/dev/elastic/master/kibana/node_modules/canvas/build/config.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',\ngyp info spawn args   '-I',\ngyp info spawn args   '/Users/kim/.node-gyp/6.12.2/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/kim/.node-gyp/6.12.2',\ngyp info spawn args   '-Dnode_gyp_dir=/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp',\ngyp info spawn args   '-Dnode_lib_file=node.lib',\ngyp info spawn args   '-Dmodule_root_dir=/Users/kim/dev/elastic/master/kibana/node_modules/canvas',\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=.' ]\nPackage cairo was not found in the pkg-config search path.\nPerhaps you should add the directory containing `cairo.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'cairo' 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 (/Users/kim/.nvm/versions/node/v6.12.2/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)\ngyp ERR! stack     at emitTwo (events.js:106:13)\ngyp ERR! stack     at ChildProcess.emit (events.js:191:7)\ngyp ERR! stack     at Process.Chisuccess Saved lockfile.
✨  Done in 12.11s.

Good point re the React warnings, I opened https://github.com/elastic/kibana/issues/16127 to fix it.

@kjbekkelund I guess you're right about the messages. Discard what I said earlier.

++ I like the self-hosted solution, if it's not easy to get a fix in upstream.

Vega's @jheer said he will try to work on it next week, so it might make sense to wait a bit on this one. I tried a "brute force" approach of copying the compiled (pre-ES6) Vega lib into its own npm package, but that didn't work too well with the webpack - it failed because require('canvas') was not found and couldn't be merged (even though the Vega code handles it correctly). The proper solution would be to clone all the affected repos, and modifying them all, but this is not a good long term strategy. There are at least three that would need modifications - vega-scenegraph, vega-wordcloud, and the main vega itself.

I fixed this issue in #16137 (hack), but hopefully there will be a better alternative upstream

my suggestion would be to see what Vega is doing. If they are fixing this soon (ie. early next week), we just bump dependency. If not, we use the #16137 work-around.

++ agreed

Thanks for the quick turnaround on this, btw. :elasticheart:

Hmm, for some reason the run:optimizeBuild fails when used with the compiled version -- https://kibana-ci.elastic.co/job/elastic+kibana+pull-request+multijob-selenium/10927/console

This has now been fixed (but not merged) with #16137 - it uses a new vega-lib package that I'm maintaining, but hopefully it will be moved to core vega soon

Was this page helpful?
0 / 5 - 0 ratings