How can I debug a Cannot start PhantomJS message when all test appear to be passing successfully in PhantomJS?

2,726 views
Skip to first unread message

Chris Boesch

unread,
Jan 12, 2013, 10:07:32 AM1/12/13
to testa...@googlegroups.com
I cloned the angular-strap project from Github and attempted to run the tests locally. When I do, I see that the tests are passing properly in PhantomJS, but also that PhantomJS can not be loaded. Can anyone help me to understand the issue or how to best proceed in debugging? 

> npm test

info: Testacular server started at http://localhost:9876/                                                                                                            
info (launcher): Starting browser PhantomJS                                                                                                                          
info (PhantomJS 1.8): Connected on socket id Zu4sILWlA1I_XjmIDoRO                                                                                                    
PhantomJS 1.8: Executed 57 of 57 SUCCESS (1.801 secs / 1.418 secs)                                                                                                   
info: Disconnecting all browsers                                                                                                                                     
error (launcher): Cannot start PhantomJS 

Thanks, 
Chris

Vojta Jína

unread,
Jan 12, 2013, 1:28:04 PM1/12/13
to testa...@googlegroups.com
Hmmm, weird, what OS you are on?

I just cloned the repo and it works fine. It looks like your tests were executed just fine and then, when killing the browser (Phantom), it exited with a non zero code, that's why you saw the error log.

You can always go into Testacular's code and do some hacking...

V.


--
You received this message because you are subscribed to the Google Groups "testacular" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testacular/-/PB7poGmZ_KIJ.
To post to this group, send email to testa...@googlegroups.com.
To unsubscribe from this group, send email to testacular+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testacular?hl=en.

Chris Boesch

unread,
Jan 13, 2013, 1:01:54 AM1/13/13
to testa...@googlegroups.com
I'm running on Ubuntu 12.04.1 LTS. 

I then installed the following in my project directory on a system with Node installed. 

npm install testacular -g
npm install phantomjs
npm install jscoverage 

phantomjs and jscoverage appear to be correctly installed in the node_modules directory in my project directory. 

If I run "npm test" without any  edits after I clone angular-strap I get: 

error (reporter): Reporter "coverage" does not exist!                                                                                                                
info: Testacular server started at http://localhost:9876/                                                                                                            
info (launcher): Starting browser PhantomJS                                                                                                                          
info (PhantomJS 1.8): Connected on socket id Fvo71QGyCOYTItXxechA                                                                                                    
PhantomJS 1.8: Executed 57 of 57 SUCCESS (1.768 secs / 1.434 secs)                                                                                                   
info: Disconnecting all browsers                                                                                                                                     
error (launcher): Cannot start PhantomJS  

So I'm suspicious that it has something to do with the reporters and my path configuration, but I'm unclear at how to proceed with debugging since the tests run properly and there are no error messages other than these.  

Chris

Vojta Jína

unread,
Jan 13, 2013, 1:38:16 AM1/13/13
to testa...@googlegroups.com
The reporter error, that's because "coverage" reporter has not been released in stable version yet, so you need canary version. (npm install -g testacular@canary)

I'm not sure what is the reason of the launcher error - because it's obvious your PhantomJS is started and works fine. It just, for some reason, exits with non-zero code and therefore Testacular shows this error. No idea why...

V.


To view this discussion on the web visit https://groups.google.com/d/msg/testacular/-/SJc0gFFdrZ4J.

Chris Boesch

unread,
Jan 13, 2013, 9:51:18 PM1/13/13
to testa...@googlegroups.com
Thanks. Installing testacular@canary addressed the coverage reporter issue. 

As far as the PhantomJS exit code goes, is there anything that you recommend that I try to hack on first to figure out what might be happening? 
Is there a line  of code that I could change somewhere to get some additional debugging? 
Also, is the PhantomJS server being shut down in a different manner than it is being launched and accessed to run tests? From a different port for example? 

Thanks, 
Chris

Vojta Jína

unread,
Jan 15, 2013, 3:56:47 AM1/15/13
to testa...@googlegroups.com
The error is coming from https://github.com/vojtajina/testacular/blob/master/lib/launchers/Base.js#L122, this callback is called when the process exits.


To view this discussion on the web visit https://groups.google.com/d/msg/testacular/-/b-Og89gmxskJ.

Carl Youngblood

unread,
Feb 27, 2013, 7:58:56 AM2/27/13
to testa...@googlegroups.com
I'm experiencing this problem on an ubuntu 12.04 system with testacular 0.4.0. Here is my conf file and output example:

https://gist.github.com/cayblood/5047729

Let me know if you want to see something else. As you can see the tests pass but it still thinks that PhantomJS didn't start.

Thanks,
Carl

Vojta Jína

unread,
Mar 2, 2013, 3:11:34 PM3/2/13
to testa...@googlegroups.com
This is weird. It looks like the tests are run and pass, but PhantomJS, when killed, returns a non-zero exit code.

What version of phantomjs do you have ? `phantomjs --version` ?

The error message is a bit lame - it says PhntomJS didn't start, but in this case it really means "it exited with a non-zero status code".

V.


To unsubscribe from this group and stop receiving emails from it, send an email to testacular+...@googlegroups.com.

To post to this group, send email to testa...@googlegroups.com.

Vojta Jína

unread,
Mar 20, 2013, 12:02:42 AM3/20/13
to karma...@googlegroups.com

Can you try calling the phantomjs binary directly (this is a node's wrapper) ?
process.env.PHANTOMJS_BIN = 'node_modules/phantomjs/lib/phantom/bin/phantomjs';

V.


On Thu, Mar 7, 2013 at 7:40 AM, <perl.j...@gmail.com> wrote:
This is happening for me when I install the latest PhantomJS (1.8.1) from NPM and use process.env['PHANTOMJS_BIN'] = 'node_modules/.bin/phantomjs'

Vojta Jína

unread,
Mar 20, 2013, 6:59:23 PM3/20/13
to karma...@googlegroups.com
I have honestly no idea why PhantomJS is returning non-zero exit code.

Can you try to capture it manually ?
- create an init file with "(new WebPage()).open("http://localhost:9876/");"
- once Karma is running, in a separate terminal, capture the phantom by executing:
<path-to-phantom-binary> --debug <path-to-the-init-file.js>

And after the test run, just kill the PhantomJS process with CTRL+C.
Check out the exit code by echo $?
See the debug output, if there is anything suspicius...

Other than that, no idea, I can't reproduce it.

V.


On Wed, Mar 20, 2013 at 5:41 AM, <b2m...@gmail.com> wrote:
Having the same issue with Ubuntu 12.04, node 0.8.7, PhantomJS 1.8.2 and just cloned the seed repo.
Installed PhantomJS locally (not with -g) and set the bin path as you suggested. Seems to run the tests but then exit with a failure.

PhantomJS 1.8 (Linux): Executed 5 of 5 SUCCESS (0.223 secs / 0.028 secs)
ERROR [launcher]: Cannot start PhantomJS

--
You received this message because you are subscribed to the Google Groups "karma-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karma-users...@googlegroups.com.
To post to this group, send email to karma...@googlegroups.com.
Visit this group at http://groups.google.com/group/karma-users?hl=en.

Vojta Jína

unread,
Mar 29, 2013, 7:10:51 PM3/29/13
to karma...@googlegroups.com
Oli, thanks for link to this commit!

Guys, what OS and PhantomJS version you are experiencing this ? I still can't reproduce it on my Mac, even with latest PhantomJS 1.9.0...




V.


On Thu, Mar 28, 2013 at 1:06 AM, <oli....@gmail.com> wrote:

I came accross the same problem just after updating PhantomJS.

It seems they modified their runner to return with error code 1 when PahntomJS is simply killed.

See commit:
https://github.com/Obvious/phantomjs/commit/8921fb75c4f3ff2989c90c6b050831d2abf9d0db

My current solution is to modify process.exit(1) to process.exit(0) in the phantomJS runner.
But I think it should be corrected either in karma or phantomJS.

Olivier Samyn.
Reply all
Reply to author
Forward
0 new messages