Error - running spookyjs
Asked Answered
C

3

11

I am getting the following error in windows while running spookyjs but code is working in linux.

Error

events.js:85
throw er; // Unhandled 'error' event
        ^
Error: spawn casperjs ENOENT
at exports._errnoException (util.js:746:11
at Process.ChildProcess._handle.onexit (ch
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)

Note:

I have installed all the dependencies and added the PATH varaiables

  1. Phantomjs
  2. Python
  3. casperjs - Installed globally using npm install -g casperjs

In the command prompt casperjs is working

What I have tried:

  1. Installed npm as global using

     npm install -g npm
    
  2. Uninstalled 0.12 and downgraded to 0.10.

  3. Added System variable C:\Windows\System32;.

Any idea or suggestion will be grateful

Cuddle answered 24/7, 2015 at 12:6 Comment(1)
were you able to solve this issue?Lorou
G
1

spawn is trying to execute the casperjs command, make sure you can execute it from your cmd.exe console. If this is not executing locate the casperjs binary and make sure it's added to the PATH

Goodwill answered 30/7, 2015 at 18:44 Comment(0)
G
1

Any update? I have the same issue.

Both phantomjs & casperjs are in the PATH and work from cmd.exe. Tried to install it globally too...

I'm running out of options!

EDIT: OK I didn't test this but it makes sense. Apparently spawn can't handle .bat and .cmd files, hence why it does work from cmd.exe but not from spawn when PhantomJS and CasperJS are installed via npm. Installing them manually should work because you'll have phantomjs.exe and casperjs.exe. Gonna try it tonight.

EDIT2: Yep. Works. Install them manually (and put the new path in the PATH variable) and you're good to go.

Gq answered 18/8, 2015 at 17:5 Comment(1)
what do you mean by "install them manually" I downloaded the folders both casper and phatom from their respectives sites and they do not have an installer so I just placed the two folders on C:/ and added the path to my Path enviroment variable. Still not working, what did I miss?Lorou
S
0

Actually spawn is execute casperjs cmd you in windows.In linux you were using like this

var casperjs = spawn('casperjs', [__dirname+'******', username]);

but in windows if you have installed casperjs globally try this

var casperjs = spawn('casperjs.cmd', [__dirname+'******', username]);

or give full path in spawn("full installation path")

For me this is working on windows hopefully this will help you too.

Spectroscopy answered 25/12, 2019 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.