karma-runner / karma-phantomjs-launcher

A Karma plugin. Launcher for PhantomJS.
MIT License
281 stars 131 forks source link

Karma cannot start PhantomJS on Windows Server 2012 #63

Open brandon-arnold opened 9 years ago

brandon-arnold commented 9 years ago

Hi all,

I have a project that is working on all of the development workstations cross-platform, but not on my Jenkins server. If I remote in with the same account Jenkins uses and run grunt karma, I get a number of Cannot start PhantomJS errors, with no useful debug information aside from the exit code 3221225477 (see below, whereby I have the karma config set to DEBUG).

I have tracked down the phantomJS exe that is being used to the appropriate lib folder beneath karma-phantomjs-launcher in the project's node modules, and verified that it is running that exe.

Is there anything someone can suggest I try?

DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-jade-preprocessor.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-ng-html2js-preprocessor.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-ng-jade2js-preprocessor.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-ng-scenario.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-requirejs.
DEBUG [plugin]: Loading plugin D:\Jenkins\workspace\...\n
ode_modules/karma-script-launcher.
WARN [karma]: Port 8080 in use
INFO [karma]: Karma v0.12.31 server started at http://localhost:8081/
INFO [launcher]: Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at C:\Users\Jenkins\AppData\Local\Temp\karma
-89315879
DEBUG [launcher]: D:\Jenkins\workspace\...\node_modules\k
arma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe C:\User
s\Jenkins\AppData\Local\Temp\karma-89315879/capture.js
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
bower_components/angular-route/angular-route.js" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
app/app.coffee" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
components/**/*.js" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
components/**/*.coffee" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
components/**/*.jade" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
components/**/*.html" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
app/**/*.coffee" does not match any file.
WARN [watcher]: Pattern "D:/Jenkins/workspace/.../client/
app/**/*.jade" does not match any file.
DEBUG [preprocessor.html2js]: Processing "D:/Jenkins/workspace/...my files...
DEBUG [watcher]: Resolved files: ...my files...
DEBUG [launcher]: Process PhantomJS exited with code 3221225477
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir C:\Users\Jenkins\AppData\Local\Temp\karma-89
315879
INFO [launcher]: Trying to start PhantomJS again (1/2).
DEBUG [launcher]: Restarting PhantomJS
DEBUG [temp-dir]: Creating temp dir at C:\Users\Jenkins\AppData\Local\Temp\karma
-89315879
DEBUG [launcher]: D:\Jenkins\workspace\...\node_modules\k
arma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe C:\User
s\Jenkins\AppData\Local\Temp\karma-89315879/capture.js C:\Users\Jenkins\AppData\
Local\Temp\karma-89315879/capture.js
DEBUG [launcher]: Process PhantomJS exited with code 3221225477
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir C:\Users\Jenkins\AppData\Local\Temp\karma-89
315879
INFO [launcher]: Trying to start PhantomJS again (2/2).
DEBUG [launcher]: Restarting PhantomJS
DEBUG [temp-dir]: Creating temp dir at C:\Users\Jenkins\AppData\Local\Temp\karma
-89315879
DEBUG [launcher]: D:\Jenkins\workspace\...\node_modules\k
arma-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe C:\User
s\Jenkins\AppData\Local\Temp\karma-89315879/capture.js C:\Users\Jenkins\AppData\
Local\Temp\karma-89315879/capture.js C:\Users\Jenkins\AppData\Local\Temp\karma-8
9315879/capture.js
DEBUG [launcher]: Process PhantomJS exited with code 3221225477
ERROR [launcher]: Cannot start PhantomJS

DEBUG [temp-dir]: Cleaning temp dir C:\Users\Jenkins\AppData\Local\Temp\karma-89
315879
ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up.
DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.
chrisstoy commented 9 years ago

I'm having a similar problem. Karma is running fine for me on Unix/Mac, but failing with a bunch of warnings like this on Windows:

[2015-03-27 13:24:16.160] [WARN] watcher - Pattern "e:/dev/cli/trunk/runtime/ui/bower_components/angular-mocks/angular-mocks.js" does not match any file.

That file exists, but for some reason Karma isn't finding it.

I'm guessing it is the backslashes in the path, but can't figure out why they are getting changed.

brandon-arnold commented 9 years ago

That happens because you haven't added the angular-mocks package to your karma.conf.js.

robdmoore commented 9 years ago

I think I have a similar issue to this on my build server. It works fine locally. It also works fine locally on that server when I run it as the same user, but fails when run from Bamboo. I have no idea how to debug this problem. The error code I get is different: 4294967295.

build   14-Apr-2015 08:11:00      DEBUG [launcher]: Process PhantomJS exited with code 4294967295
build   14-Apr-2015 08:11:00      ERROR [launcher]: Cannot start PhantomJS
brandon-arnold commented 9 years ago

Looking into it, I am pretty sure this is nothing to do with karma-phantomjs-launcher, but is in fact a bad build of PhantomJS hosted on their binary server at Bitbucket. The later version (2.0) works on the system. If I have time, I'll fork this repo and try to update it, or if someone else can do it in the meantime, that would be very helpful. In the meantime, I'll try to use Chrome version in a non-UI session (you need a version from at least four months ago, as referenced in this thread).

robdmoore commented 9 years ago

Interesting - so if I update to phantomjs 2 it will work? The latest version on npm is still 1.9.16 so I guess I have to wait until it's released there or try and hack something together.

robdmoore commented 9 years ago

https://github.com/Medium/phantomjs/issues/288

brandon-arnold commented 9 years ago

@robdmoore: I can only say that version 2 runs and works from command line. I haven't configured it in karma-phantomjs-launcher yet. FWIW: my Jenkins server is working fine now using Chrome as a non-UI system process, which I'll stick to using for now.

dignifiedquire commented 9 years ago

Ref #56