spawn casperjs ENOENT error on AWS elastic beanstalk

499 views Asked by At

I am trying to run a casper scraper on nodejs using SPOOKY. The scraper works fine when I run it on the localhost but gives the error below when I deploy the project on AWS elastic beanstalk server.

Error: spawn casperjs ENOENT
    at exports._errnoException (util.js:1018:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
[nodemon] app crashed - waiting for file changes before starting...

I have tried setting binPath: './node_modules/casperjs/bin/casperjs'" and tried installing Casper globally but was unable to do it. I also added command: /^win/.test(process.platform) ? 'casperjs.cmd' : 'casperjs', to the child but that did not work out either.

I have been searching this for more then a week but was unsuccessful.

Please help me in this issue.

1

There are 1 answers

0
yAnTar On

You need to install globally casperjs - npm i -g casperjs

You can read more here