Setup Electron with Nightmare on Cloud9 for testing



Hi folks,
I’ve installed Nightmare package from NPM for testing and automation which is based on Electron.
Now there is an issue with runnging Electron without gui I think because Cloud9 workspace doesn’t support this feature.

So, my json package:

  "scripts": {
    "start": "DEBUG=nightmare babel-node ./main.js"
  "devDependencies": {
    "babel-cli": "6.18.0",
    "babel-preset-modern-node": "3.2.0",
    "babel-preset-stage-0": "6.16.0"
  "dependencies": {
    "nightmare": "2.10.0"
  "babel": {
    "presets": [
        { "version": "6.0" }

It is not necessary to include Electron package because Nightmare has dependencies for it.

Now when Nightmare package installed I’am trying to run basic script for testing if it works (main.js):

import Nightmare from 'nightmare';
const nightmare = Nightmare({ show: false });

  .type('#search_form_input_homepage', 'github nightmare')
  .wait('#r1-0 a.result__a')
  .evaluate(() => document.querySelector('#r1-0 a.result__a').href)
  .catch((error) => {
    console.error('Search failed:', error);

As a result it throws an arror:

$ npm start

> @ start /home/ubuntu/workspace/nm
> DEBUG=nightmare babel-node ./main.js

  nightmare queuing process start +0ms
  nightmare queueing action "goto" for +4ms
  nightmare queueing action "type" +1ms
  nightmare queueing action "click" +1ms
  nightmare queueing action "wait" +0ms
  nightmare queueing action "evaluate" +0ms
  nightmare running +0ms
  nightmare electron child process exited with code 1: general error - you may need xvfb +92ms
  nightmare electron child process not started yet, skipping kill. +2ms

I’am pretty new to this stuff and tried as I can but now I’am stuck. Really want to use this package. I think there is a simple solution, may be I should configure Electron somehow to run without GUI or as a node process but I don’t know how.

Any advice will be appreciated, thanks!