Testing nightmare.js example code but no result shown



I am running the example code of nightmare.js on c9,io, a virtual machine for ubuntu. The example.js does not return anything. Could someone review what the problem here?I am a total beginner for node.js and c9 so the issue might lie in some very simple process.Attached is the screen cut just in case I made a mistake like placing it in a wrong location.

 var Nightmare = require('nightmare');
 var nightmare = Nightmare({ show: true });

  .type('form[action*="/search"] [name=p]', 'github nightmare')
  .click('form[action*="/search"] [type=submit]')
  .evaluate(function () {
    return document.querySelector('#main .searchCenterMiddle li a').href
  .then(function (result) {
  .catch(function (error) {
console.error('Search failed:', error);


this happens because nightmare.js doesn’t run well in headless mode and hides all error messages

DEBUG=nightmare* node example.js 

will suggest to install xvfb
And after installing it by running:

sudo apt-get update &&\
    sudo apt-get install -y libgtk2.0-0 libgconf-2-4 \
    libasound2 libxtst6 libxss1 libnss3 xvfb

nighmare works when launched with xvfb-run command

DEBUG=nightmare* xvfb-run node example.js 


I cannot find any tutorial of installing xvfb on cloud9.
How should I do it?
If I got a new Mac, will I solve this problem?


there is a tutorial in my previous answer, see the code snippet with sudo apt-get. I’ll edit the answer to make this more obvious.


Please look here: