brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 286 forks source link

Unhandled 'error' event #57

Closed techbirds closed 10 years ago

techbirds commented 10 years ago
var webshot = require('webshot');
var fs      = require('fs');

webshot('google.com', function(err, renderStream) {
    var file = fs.createWriteStream('google.png', {encoding: 'binary'});

    renderStream.on('data', function(data) {
        file.write(data.toString('binary'), 'binary');
    });
});

error:

events.js:77 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at exports._errnoException (util.js:676:11) at Process.ChildProcess._handle.onexit (child_process.js:772:32)

brenden commented 10 years ago

This happens when the phantomjs application isn't installed or isn't present in the PATH variable. Here is a similar issue: https://github.com/brenden/node-webshot/issues/42

If you can run phantomjs from a command line, this problem should go away.