Saving VegaLite Plots as SVG on Centos 6.1

Hi, I am trying to get VegaLite (v2.1.3) to work on CentOS 6.1.
Unfortunately, with no avail. I can produce plots fine, but saving them does not work.

using VegaLite
p = @vlplot(:line, y = rand(10));
save("test.svg", p)

gives /usr/lib64/libstdc++.so.6: version GLIBCXX_3.4.14' not found (and similar) Compiling a new version of libstdc solved this issue but then it complained about missing libc.so versions (/lib64/libc.so.6: version GLIBC_2.16’ not found). After compiling this (and of course setting LD_LIBARY_PATH accordingly) julia did not start anymore.
It seems that the vega to svg converter is written in node.js and the compiler on centos is too old.
I found a similar issue here Linux install problems - CXXABI_1.3.9 not found
But the proposed solution there did not help me.
I am not a linux expert, so I am a bit lost. Any help appreciated.
The output of my versioninfo is

Julia Version 1.4.1
Commit 381693d3df* (2020-04-14 17:20 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, westmere)

VegaLite.jl uses NodeJS.jl under the hood to save a plot as an SVG file. Could you try to run pkg> add NodeJS and then pkg> test NodeJS to see whether that works?

NodeJS.jl uses the artifact system to download the binaries that are hosted on the original nodejs site, so my best guess is that those binaries for some reason don’t work with CentOS?

Thank you for the quick reply and of course for your much appreciated work for the Julia community.
Unfortunately, testing NodeJS fails with the same error.
The linked discourse thread above also deals with node.js problems under centos, but it did not solve my issue. Can I tell NodeJS.jl to use a different node installation?

I tried to implement NodeJS.jl such that if it doesn’t find an artifact for a given platform, it would just try to run node and hope for the best, i.e. that there is a version of node on the PATH that works. But I think the problem here is that we do have an artifact for CentOS, it just doesn’t work…

You might be able to follow this to somehow get NodeJS.jl to not use the version of nodejs that it downloads. I think ideally you would actually try to configure it to use an alternate artifact, which then happens to not have a binary for your platform, so that you fall back to the “let’s just try to use node” strategy. But I have never tried that, so not sure whether this can work.

If there are things that I could change about NodeJS.jl to make it easier to use a system node installation, I’d be more than happy to make those changes!

Again thank you very much for your help.
Changing the node Version worked, but now the node version is too old.
I guess centos 6 is just too old to get this working.
Maybe it will be easier to update the os.

Interesting, which version of node do you get?

 node --version
v0.10.48

The error is

const vega = require('vega');
^^^^^
SyntaxError: Use of const in strict mode.

in vg2svg.j
I tried to compile a newer version of node, but then the needed python is too old. At that point I gave up.

If that is the only problem, I’d be happy to adjust those files if that would get it to work! They are in GitHub - queryverse/VegaLiteBuilder.

Googling a bit showed that strict mode together with const did not work in older versions.
If I change const to var, the next error is in the Promise.

 return new Promise((resolve, reject) => {
                                          ^
SyntaxError: Unexpected token >

I have to admit that I don’t know JavaScript and I have no clue how to fix that.

To me this looks as if that version of node doesn’t support modern anonymous function syntax. You could try to replace (resolve, reject) => with function(resolve, reject), I think that is the older syntax that might just work?

That worked, but of course the next error pops up. I guess I’ll look for someone who knows javascript over the weekend.
If I manage to fix this, I’ll post the solution here. Thank you for your help.

I’m also happy to continue this back and forth, I’d like to get everything to work on as many platforms as possible, so happy to help! We should probably figure out whether the vega packages themselves work on these older node versions, because we can’t make changes to them if that turns out to be a problem…

I am away from my work computer for today. The next issues are also remaining anonymous functions.
I’ll try to fix them over the weekend.
Do you have an idea how I could check whether vega itself runs on my old software?

Not really, to be honest…

Sorry for the late response.
I tried to get rid of all the anonymous functions, but I was not succesful.
And it seems that vega itself will not run with the old node version. At least in vega-util.js there are also incompatible statements.
I am a bit out of ideas how to proceed to be honest.

So that I think is a thing we can’t work around… I think realistically the only option would be that you manage to somehow get a more modern version of node to run on centos 6.1…