2

I am getting this error in the command line when I run app.js on node:

FATAL ERROR: v8::HandleScope::CreateHandle() Cannot create a handle without a HandleScope
Abort trap: 6

This is what am app.js looks like:

var phantom = require('x-ray-phantom');
var Xray = require('x-ray');
var fs = require('fs');

x = new Xray().driver(phantom());;
x('http://www.bbc.co.uk/news', '.most-popular__list panel-read li', [{
  content: ''
}])(function (err, results) {
  fs.writeFile('results.json', JSON.stringify(results, null,  '\t'));
})

My package.json

{
  ...
  "dependencies": {
    "phantomjs": "^1.9.19",
    "x-ray": "^2.0.2",
    "x-ray-phantom": "^1.0.1"
  }
  ...
}

My node version is v5.3.0, Npm version is 3.3.12, Phantomjs version is 1.9.8. I am on a Mac El Capitan 10.11.1

user1275105
  • 2,643
  • 5
  • 31
  • 45
  • I had the same problem, downgraded node.js from v5.3.0 to v4.2.4, did a npm rebuild, and everything works fine. – Tom Broucke Dec 31 '15 at 09:48

1 Answers1

0

Check if this works:

x = new Xray().driver(phantom({ dnodeOpts: { weak: false } }));

I use phantom instead of x-ray-phantom and I encountered the same issue. It appears that the module node-weak is broken (https://github.com/TooTallNate/node-weak/issues/65), and bypassing this module as this link suggests has solved my case.