8

I am building a scraper to make JS single page applications easily crawlable.

After some incredible frustration with PhantomJS (memory leaks, outdated webkit, undead processes, among many other problems) I decided to switch to NightmareJS which can do the same things but uses Electron under the hood. Electron has a lot of advantages (uses latest chromium, is a lot faster) but it needs an X server to run.

As I need to make it work under ubuntu server, I followed this gist . Now I have a great EC2 instance with everything ready to run an headless electron

xvfb-run electron

The point is that I need to run this through nightmareJS (which I will use in a node.js server script). I was wondering how I could pass parameters to nightmare in order to start electron through svfb

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
Rayjax
  • 7,494
  • 11
  • 56
  • 82
  • You probably should ask this in the [Nightmare issue tracker on GitHub](https://github.com/segmentio/nightmare/issues). The move to electron is pretty new and I don't know if the developers frequent Stack Overflow. – Artjom B. Sep 16 '15 at 17:34
  • 1
    The link to the gist is broken. I need this... – Ivan Rubinson Apr 30 '17 at 04:45

1 Answers1

4

I don't know if there is a better way, but at least for my works run the main process using xvfb-run command:

$ xvfb-run node --harmony simple-service.js
Worker 12153 is online
Worker 12155 is online
Worker 12154 is online
Worker 12156 is online