brenden / node-webshot

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

Webshot/child_process can't create the Phantom process when phantomConfig is used #74

Closed amyboyd closed 10 years ago

amyboyd commented 10 years ago

My config contains this:

phantomConfig: {
  'ignore-ssl-errors': 'true'
},

When I run node path/to/node/ThumbnailWorker.js, this error is thrown:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

The command that Webshot is trying to run through child_process.spawn is this:

/home/our-user/project/node_modules/phantomjs/lib/phantom/bin/phantomjs "--ignore-ssl-errors=true" "/home/our-user/project/node_modules/webshot/lib/webshot.phantom.js" "https://api.our-website.com/preview-for-gearman-screenshoter/xxxxx" "null" "true" "{\"windowSize\":{\"width\":1200,\"height\":1550},\"shotSize\":{\"width\":\"window\",\"height\":\"window\"},\"shotOffset\":{\"left\":0,\"right\":0,\"top\":0,\"bottom\":0},\"defaultWhiteBackground\":true,\"streamType\":\"png\",\"siteType\":\"url\",\"quality\":75,\"errorIfStatusIsNot200\":true,\"settings\":{\"resourceTimeout\":5000}}"

That command ran manually in the terminal correctly prints out the image data.

I've tried changing Webshot to use child_process.exec, running as sudo, and lots of other things, but I can't get this to run. :( It runs fine without phantomConfig.

Any ideas?

amyboyd commented 10 years ago

This issue is invalid, and is not a problem with Webshot.

The problem was in our own JS file, we were doing some transformation with Node's ImageMagick library. ImageMagick wasn't installed on the system. :( We saw the error and could only think it was Webshot dying when creating the Phantom child process.