Skip to content

Instantly share code, notes, and snippets.

@SantoshSrinivas79
Last active April 24, 2024 03:09
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SantoshSrinivas79/130877925f52c8fb2557 to your computer and use it in GitHub Desktop.
Save SantoshSrinivas79/130877925f52c8fb2557 to your computer and use it in GitHub Desktop.
Running electron using xvfb

Running electron using xvfb

Install xvfb

apt-get install xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps

Some tips at: xvfb init script for Ubuntu

Install electron

sudo npm install electron-prebuilt -g
sudo apt-get install libasound2

On Ubuntu, I was running into some module errors. To correct the errors, I installed the following packages as mentioned at Build Instructions Linux:

sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
                       libnotify-dev libgnome-keyring-dev libgconf2-dev \
                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \
                       libxss1 libnss3-dev gcc-multilib g++-multilib

Now, an app can be run using xvfb in a headless mode using xvfb-run electron . in the project directory.

@Rayjax
Copy link

Rayjax commented Sep 17, 2015

Hey, just tested it on an ubuntu server (EC2) doing exactly what you wrote.

xvfb-run electron
[1227:0917/122411:ERROR:browser_main_loop.cc(189)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
Xlib: extension "RANDR" missing on display ":99".
module.js:338
throw err;
^

Error: Cannot find module '/usr/local/lib/node_modules/electron-prebuilt/dist/resources/atom.asar/browser/lib/init.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Function.Module.runMain (module.js:471:10)
at startup (node.js:139:18)
at node.js:991:3

As RANDR is missing, I tried to add it using

Xvfb +extension RANDR

but it get stuck at Initializing built-in extension GLX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment