busterjs / buster

Abandoned - A powerful suite of automated test tools for JavaScript.
http://docs.busterjs.org
Other
448 stars 37 forks source link

buster-server fails on headless mode on Windows 8 #434

Open atlefren opened 9 years ago

atlefren commented 9 years ago

os: Windows 8 enterprise

When trying to run buster-server with the -c option (for headless mode on win8) an error occurs and the process dies, but things work just fine without the -c option.

C:\>buster -v
Buster.JS version 0.7.17 Beta 5

C:\>phantomjs -v
1.9.8

C:\>buster-server -c
Starting headless browser...
buster-server running on http://localhost:1111

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

C:\>buster-server
buster-server running on http://localhost:1111

This works as excpected on Ubuntu 14.10:

atlefren@marjory:~$ buster -v
Buster.JS version 0.7.8 Beta 5
atlefren@marjory:~$ phantomjs -v
1.9.8
atlefren@marjory:~$ buster-server -c -p 1112
Starting headless browser...
buster-server running on http://localhost:1112
Browser was captured.
atlefren commented 9 years ago

Same behavior on Windows 7 Enterprise

dwittner commented 9 years ago

With Windows 7 Professional 64 bit and phantom.js 1.9.7 all works fine for me. Unfortunately i don't have Windows 7 Enterprise or Windows 8 Enterprise. Do you know if phantom.js generally works on the machines, independently of Buster.JS?

dwittner commented 9 years ago

@atlefren, could you please provide further informations?

dwittner commented 9 years ago

@atlefren, i tried to reproduce the issue on a Windows 7 Enterprise machine, but for me buster-server -c runs without any errors. I got the same error message you get, before i had installed phantom.js though. Please ensure you have phantom.js on your machines and the path to the phantom.js executable in your PATH environment variable.

atlefren commented 9 years ago

@dwittner Sorry for the delay, extended vacation to blame.

Will check as soon as possible, thanks for following up!

atlefren commented 9 years ago

@dwittner

I installed phantomjs using npm, and haven't been using it for anything else.

The "phanthomjs -v" command returns a version number (as above), and "phantomjs" gives me an interactive prompt, that seems to be working fine.

My npm packages seems to be in "C:\Users\Atle\AppData\Roaming\npm", which is on my PATH. This is the same directory as buster is installed in.

atlefren commented 9 years ago

Ah!

Finally I got to the root cause of this. It seems like buster-server and phantomjs doesn't play nice on Windows when phantomjs is installed using npm (due to this: https://github.com/joyent/node/issues/2318)

So, the solution was to uninstall the phantomjs installed via npm and install a phantomjs.exe file. Worked as expected after this.

(this is probably a known thing for node-windows users, but as this worked fine on Linux I could not understand why it didn't work on windows). Maybe worth adding to the readme if it isn't already there?

dwittner commented 9 years ago

Thanks for the info. I will try to find a way phantomjs from npm can also be used on windows.

dominykas commented 8 years ago

The solution is to use cross-spawn-async (released with grunt-buster@0.4.2) - but I have to revisit the phantom-proxy - I think it's not really needed and things can be simplified.

I also need to get my hands on a proper Windows machine with full dev tools, as phantomjs seems to crash a lot on Appveyor - it could be memory issues or whatever other random stuff.