Super user glitch console?

How can I install command-line tools, binaries etc.?

I want to install zlib, fontconfig, freetype, libX11, libXext, libXrender, wkhtmltopdf

How can I do this?

You can simply head to package.json file and search for the project you want to add at the top, and select appropiate package.
Or well you can use the console as well.
Open the console and type
npm i packageName and gitch will install the package.

These aren’t node packages

Hello @NoobDoesMC,

we don’t allow root access inside the project container. We are considering adding those packages to the container image so that they will be accessible to everyone :slight_smile: Just one question: what is wkhtmltopdf? Do you need that specific html-to-pdf package, or a similar one would work for you too?

wkhtmltopdf is a dependency of the same-name npm package

I want to use it to turn html into png and serve rendered pngs to the client.

Hey @NoobDoesMC,

I was able to install wkhtmltopdf by downloading a compiled version for Linux AMD64. I moved the binaries to ~/bin which is included in the $PATH of the default shell.

File is almost 40mb, something to keep in mind since these instances only allow us to have 128mb in our home folder (/app, check with $ df -h).

Here are the instructions:

  1. Download the tarball from the Github releases in the /tmp directory (pretty cool we have a lot of space there, not sure if it’s per instance but mine had 30gb) and untar that.
$ cd /tmp
$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar vxf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
  1. Copy that to ~/bin, so it’s available from the command-line.
$ mv wkhtmltox/bin/wkhtmltopdf ~/bin/
  1. Go back to home and check if it’s available.
$ cd
$ wkhtmltopdf --version
wkhtmltopdf 0.12.4 (with patched qt)
  1. If it’s working, clean up the mess.
$ rm -r /tmp/wkhtmltox /tmp/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
  1. Test it:
$ wkhtmltopdf http://google.com google.pdf
  1. And for the sake of this short tutorial, upload it somewhere to view it (link in this example expires in 14 days)
$ curl --upload-file google.pdf https://transfer.sh/google.pdf
https://transfer.sh/agAU3/google.pdf

So what about installing the NPM package and use it from a Node.js application?

Once this is setup, you’ll be able to install the dependency and use it from your app.

I created a very simple Glitch app so you can see it in action, you can remix it from there.

https://wkhtmltopdf-example.glitch.me (edit link)

Good luck, have fun!

5 Likes

And to actually answer your question, this process can be done for the rest of your libraries.

We have access to $ apt-get source (to download source) and we can compile (make sure to do that in the /tmp folder), but the process will depend on the package you’re trying to install, so I’ll leave that to you.

Hit me up if you have any questions.

:call_me_hand: