# Saving VegaLite Plots as SVG on Centos 6.1

**URL:** <https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460>\
**Category:** General Usage\
**Created:** [May 14, 2020, 10:48am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460 "2020-05-14T10:48:04Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 14, 2020, 10:48am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/1 "2020-05-14T10:48:04Z")

</div>

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.

```julia
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](https://discourse.julialang.org/t/linux-install-problems-cxxabi-1-3-9-not-found/38897)  
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
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)

```

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 14, 2020, 12:48pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/2 "2020-05-14T12:48:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 14, 2020, 2:44pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/3 "2020-05-14T14:44:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 14, 2020, 5:08pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/4 "2020-05-14T17:08:00Z")

</div>

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](https://julialang.github.io/Pkg.jl/v1/artifacts/#Overriding-artifact-locations-1) 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!

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 15, 2020, 9:41am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/5 "2020-05-15T09:41:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 15, 2020, 10:07am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/6 "2020-05-15T10:07:09Z")

</div>

Interesting, which version of node do you get?

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 15, 2020, 10:16am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/7 "2020-05-15T10:16:24Z")

</div>

```julia
 node --version
v0.10.48

```

The error is

```julia
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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 15, 2020, 10:49am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/8 "2020-05-15T10:49:20Z")

</div>

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](https://github.com/queryverse/VegaLiteBuilder).

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 15, 2020, 11:13am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/9 "2020-05-15T11:13:56Z")

</div>

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.

```julia
 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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 15, 2020, 11:51am UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/10 "2020-05-15T11:51:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 15, 2020, 2:31pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/11 "2020-05-15T14:31:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 15, 2020, 5:13pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/12 "2020-05-15T17:13:19Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 15, 2020, 6:14pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/13 "2020-05-15T18:14:28Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 15, 2020, 6:15pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/14 "2020-05-15T18:15:38Z")

</div>

Not really, to be honest…

---

<div class="post-metadata">

**Author:** ![Rudi79](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rudi79/32/3884_2.png) [@Rudi79](https://discourse.julialang.org/u/Rudi79)\
**Post date:** [May 18, 2020, 2:39pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/15 "2020-05-18T14:39:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidanthoff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/davidanthoff/32/223493_2.png) [@davidanthoff](https://discourse.julialang.org/u/davidanthoff)\
**Post date:** [May 18, 2020, 5:00pm UTC](https://discourse.julialang.org/t/saving-vegalite-plots-as-svg-on-centos-6-1/39460/16 "2020-05-18T17:00:20Z")

</div>

> [@Rudi79](#):
>
> At least in vega-util.js there are also incompatible statements.

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…
