node-scraper icon indicating copy to clipboard operation
node-scraper copied to clipboard

jsdom.jQueryify() not passing correct directory syntax on Windows node environments

Open iampatgrady opened this issue 10 years ago • 0 comments

The following code in your project does not work on a Windows Node.js environment:

jsdom.jQueryify(window, __dirname + '/../deps/jquery-1.6.1.min.js'), function (win, $) {
    $('head').append($(body).find('head').html());
    $('body').append($(body).find('body').html());
    callback(null, $);
});

Please add require('path'); to the scraper.js file and then make this slight modification to the above code:

jsdom.jQueryify(window, path.join(__dirname , '/../deps/jquery-1.6.1.min.js')), function (win, $) {
    $('head').append($(body).find('head').html());
    $('body').append($(body).find('body').html());
    callback(null, $);
});

With that tiny change the scraper.js works on Windows and *nix environments

sorry, i'm new to GITHUB and GIT in general, otherwise i'd submit the code myself

iampatgrady avatar Apr 02 '14 19:04 iampatgrady