Terminalizer is tool for recording terminal sessions and turning them into animated gifs. It's a way to demonstrate command line tools or share workflows. Unfortunately, there are a few hoops to jump through to install it on Ubuntu. The issues seem to be with where the global npm installer tries to put the files and the permissions that they have.
asciinema and asciicast2gif produce simpler output but are easier to install.
Here are the steps that worked for me:
# Install npm (requires dependencies) - Ubuntu 20.04
sudo apt install npm node-gyp libnode-dev libnss3 librust-gdk-pixbuf-sys-dev \
libgtk-3-0 libxss1 libasound2 libgbm1
# Install terminalizer globally with unsafe permissions
sudo npm install -g terminalizer --unsafe-perm=true
# Grant global write access to render directory
sudo chmod 777 /usr/local/lib/node_modules/terminalizer/render/
# Install npm (requires dependencies)
sudo apt install npm node-gyp nodejs-dev libssl1.0-dev
# Install terminalizer globally
sudo npm install -g terminalizer
# Remove the electron that comes with terminalizer
sudo rm -rf /usr/local/lib/node_modules/terminalizer/node_modules/electron/
# Add electron globally - based on this SO answer https://stackoverflow.com/a/52033822/3508733
sudo npm install -g electron --unsafe-perm=true --allow-root
# By this point, I could record and play sessions, but got the error in this issue when I tried to render them.
# Symlink the hardcoded rendering path to where terminalizer is actually installed on Ubuntu
sudo mkdir -p /usr/lib/node_modules/
sudo ln -s /usr/local/lib/node_modules/terminalizer/ /usr/lib/node_modules/terminalizer
# Change permissions on working directories
sudo chown -R <user> /usr/lib/node_modules/terminalizer/render
sudo chmod 4775 /usr/local/lib/node_modules/electron/dist/chrome-sandbox
For reference, and for Google's sake, here are error messages that I got along the way. Installing Terminalizer without the unsafe-perm flag caused an error with Electron:
me@u2004:/tmp$ terminalizer
/usr/local/lib/node_modules/electron/index.js:14
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
^
Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at getElectronPath (/usr/local/lib/node_modules/electron/index.js:14:11)
at Object.<anonymous> (/usr/local/lib/node_modules/electron/index.js:18:18)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Proxy.DI.require (/usr/local/lib/node_modules/terminalizer/di.js:105:29)
This next message came when I tried to render a gif:
18.04
$ terminalizer render foobar
Error:
EACCES: permission denied, mkdir '/usr/local/lib/node_modules/terminalizer/render/frames'
20.04
Error:
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/terminalizer/render/frames'
This is because the hard-coded path to the render directory belongs to root
. Also, in 18.04, it isn't where Ubuntu installs terminalizer. faressoft/terminalizer#29
Hey,
Using your exact steps in ubuntu 20.04, I got:
I obviously tried to
sudo apt install libnss3
, which even having worked, has led me to:Which I resolved with
sudo apt install librust-gdk-pixbuf-sys-dev
, but then led me to:And then I've given up. Are you sure you had a clean machine? I've just started this one on aws, and those instructions don't work.
Thanks anyway.