0

NightmareJS on c9.io is literally a nightmare.

i cannot get it to work at all i am going to run through the whole process from start to finish.

Step 1

I create a new workspace

Hosted Node.js

Step 2

Start Editing my new workspace

I open Package.json and add what i need heres my file.

{
  "name": "chat-example",
  "version": "0.0.0",
  "description": "A chat example to showcase how to use `socket.io` with a static `express` server",
  "main": "server.js",
  "repository": "",
  "author": "Mostafa Eweda <mostafa@c9.io>",
  "dependencies": {
    "async": "~0.2.8",
    "express": "~3.2.4",
    "socket.io": "~0.9.14",
    "phantomjs": "*",
    "casperjs": "*",
    "nightmarejs": "*",
    "utils": "*",
    "crypto": "*"
  }
}

i then run 'npm install' in the console.

Step 3

this is where it does not work i try all theses diffrent commands to get the examples running and the errors i get.

@stackoverflow:~/828481 $ cd node_modules/nightmarejs/examples/
@stackoverflow:~/828481/node_modules/nightmarejs/examples $ node server.js casper.js

Error: Cannot find module 'crypto'

  phantomjs://bootstrap.js:289
  phantomjs://bootstrap.js:254 in require
  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/utils/utils.js:7
  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/utils/utils.js:117
  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/utils/utils.js:118
Error: Cannot find module 'casper'

  phantomjs://bootstrap.js:289
  phantomjs://bootstrap.js:254 in require
  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/nightmarejs/lib/nightmareClient.js:4
  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/nightmarejs/lib/nightmareClient.js:83
TypeError: 'undefined' is not a function (evaluating 'require(phantom.args[3].slice(13)+'nightmareClient.js').Nightmare({
    exitOnError: false
})')

  /var/lib/stickshift/5345392f50044693d40008de/app-root/data/828481/node_modules/nightmarejs/lib/nightmareTest.js:16
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
user3407899
  • 139
  • 4
  • 16

1 Answers1

0

I have it working. I also had trouble at first. I tried downloading the prebuilt package, but I can't seem to get that working. I ended up just adding the following to my package.json file and ran npm update and all was well:

"nightmare": "^1.5.0",
"phantomjs": "~1.9.7"

Probably they've updated the npm repo and everything since you've posted this. I bet it was frustrating. I don't have those examples in my install, but I would guess you could run them if you had all of the right pre-req's installed.

Jason Cramer
  • 182
  • 1
  • 8
  • 1
    `nightmare` and `nightmarejs` are two different modules. Do not confuse them. – Artjom B. Nov 16 '14 at 15:22
  • I hadn't realized that, so I apologize, but I think the main problems to overcome are similar. I would try and boot up a Ubuntu VM or something, and build it out locally, and then once built copy it out and upload it to your c9 project. Also, just curious... I know there surely must be differences between these two modules, but what has you choosing that one over the other one? I'm wondering if I got on the wrong boat.. – Jason Cramer Feb 13 '15 at 23:49