I've started having this issue on our build machine recently (like, a few days ago). The build is run by a bamboo agent which is basically a windows service which launches "grunt". The grunt task then runs karma (among other things) for the tests. When run by the agent the build fails with this message (after 2 tries).
Running the same command line as the agent starts karma, captures the browser and generally works fine. Increasing the timeout to 3 min instead of 1 didn't help.
Did something change recently in karma that might be causing this behavior when it's run by a service without UI?
l.e.: tried with PhantomJS and IE as well, same. So I'm guessing it's a problem with Karma.
I'm seeing the exact same problem on a TeamCity build server. X = 60000 for me. I too can run the tests just fine on the build server as the TeamCity build agent user.
I have a passing build on October 7 and the first failing on October 9. I have Karma locked to 0.12.23 in package.json so it's unlikely that Karma itself is the problem. Perhaps a dependency?
My money was initially on Chrome 38, but if you say the problem occurs with PhantomJS also then I guess Chrome is off the hook...
No it's clearly Chrome in my case. I downgraded to 37 and the problem went away.
Hmm strange, since neither Phantom nor IE worked I assumed it's not the browser. But I'm surely willing to try it, however I can't really find a way to get an older version of Chrome. How did you downgrade to 37?
I uninstalled Chrome 38.
Then, I followed these instructions to disable updates: http://www.wikihow.com/Completely-Disable-Google-Chrome-Update (although I added the template as a computer policy rather than user policy).
Finally, I installed Chrome 37 from here: https://gallery.technet.microsoft.com/Google-Chrome-version-f0619a1f
Thanks a lot! I reverted to 37 (btw, some registry changes were needed as well to prevent the updates in my case, http://stackoverflow.com/questions/18483087/how-can-i-disable-google-chrome-auto-update and http://www.wintips.org/disable-google-chrome-automatic-update/) and it works!
I also tried the beta 40 build and that one doesn't work either. I guess we should report an issue to chrome so it will be eventually fixed.
@adrianhara is problem still reproduce on PhantomJS?
Thanks!
For me yes. PhantomJS works fine when karma is run manually, but starting it from the agent fails to connect to PhantomJS. Same with IE. This is why I initially thought it's a Karma issue, as all three browsers exhibited the same behavior.
Maybe it's a combination of changes? We were using karma 0.10.x until recently (it was hardcoded in package.json) and decided to switch to the latest version a few weeks back. It worked fine with Chrome until a few days ago and then it stopped.
We were actually using PhantomJS some time ago, but there were some other problems with it disconnecting after a failing test and never connecting again, so we switched to Chrome and it's been running since. 90% of our tests are testing logic not UI, so we don't actually care about the browser.
I've also experienced this issue. We're using karma + grunt + grunt-karma-runner to run tests against firefox and chrome.
The tests run fine on on a dev machine but fail when the grunt command is issued by a team city build to a team city agent (chrome not captured). Logging on to the agent itself and running the command from within the agent's build folder (i.e. running the same code just not remotely) also works fine.
@danhaller try running karma without grunt(karma start) on TeamCity.
The problem also exists when running karma start. The problem doesn't appear isolated to karma though, I've noticed that my protractor tests are acting similarly too. The chrome process starts up but no commands appear to reach it.
My situation is identical to @danhaller's. Any additional information would be appreciated. I hope pausing updates to Chrome isn't necessary because it's an involved process for a temporary gain.
A workaround for team city: Start the agent from the command line instead of as a windows service. Not ideal, but easier than downgrading chrome.
There's a bug report on the chrome bug tracker here
Not ideal, but totally works. Karma runs and my builds are successful for the first time in 6 days. Thanks! I'll be keeping an eye on this issue until its resolution.
Here is a link about starting the BuildAgent from the command line for those who are lazy:
https://confluence.jetbrains.com/display/TCD8/Setting+up+and+Running+Additional+Build+Agents#SettingupandRunningAdditionalBuildAgents-StartingtheBuildAgent
Same problem here using CCNet/Karma as Windows Service. It started failing after updating Chrome to 38.0.2125.101 on 2014/10/08. There is no problem when running from command line.
Star this issue: https://code.google.com/p/chromium/issues/detail?id=422218
I just get an update to 38.0.2125.111 and it works fine
Same problem when we are running from Bamboo build. Will try to downgrade chrome
The issue is resolved in Chrome 41.X (Currently Chrome Canary is on that version).
Yep, Chrome 39 should include a fix. This is mentioned in the chromium issue linked to by @theodorejb. It's expected to be released on November 20th.
You can manually update to Chrome 39 by navigating to chrome://chrome in your browser (I tried today and this worked).
My understanding is that 39 will be pushed in automatic updates in the next couple weeks.
Closing, as this seems to be resolved, please comment / reopen if you are still experiencing this issue.
Having trouble with Chrome Version 43.0.2357.130 m. Chrome opens with a page that says "Karma Starting", but Karma can't seem to capture the results.
PhantomJS works fine.
Karma v0.12.37
@Wasmoo Please try to open the dev tools and post your console output in general mode and in debug mode please
For me, the problem turned out to actually just be that some days, the agent really did take longer than 6 seconds to spin up the browser and connect to Karma. Since the agent shares the hardware, sometimes it would get up in time, sometimes it wouldn't. Changed the timeout to 15 seconds, and all was well.
I'm having this issue as well, on a wercker box. Haven't done anything, builds just starting failing beginning of this week. Our timeout is 60s, so that doesn't seem to be an issue
I was able to resolve this with this workaround
My problem was that Karma was attempting to execute a nonexistent file because my CHROME_BIN environment variable pointed to a file that did not exist.
To solve this, make sure Karma browser environment variables (CHROME_BIN, FIREFOX_BIN, etc.) are either unset, or point to existing binaries. For a full list, see this GitHub search: user:karma-runner ENV_CMD. You can check this by running echo $CHROME_BIN.
You can also get the exact shell command that Karma is executing to try it yourself and see if it fails. To do that, modify ./node_modules/karma/lib/launchers/process.js like so:
}
this._execCommand = function (cmd, args) {
+ log.error([cmd, args.join(' ')].join(' '));
if (!cmd) {
log.error('No binary for %s browser on your platform.\n ' +
Here's the output of env CHROME_BIN=/blah ...:

Karma waits, not realizing that the binary doesn't exist.
I had the same issue, and it was not cause by either the CHROME_BIN being unset or incorrect, nor the chrome / chromium browser version; and even the --no-sandbox option was not helping.
The issue is that I needed to setup the proxy environment variables for my Jenkins job (run through a docker) to ensure npm could install dependencies, and I simply forgot to reset the environment variables once the dependencies were downloaded.
Local headless chrome needed no proxy configuration in my case, hence :
export HTTP_PROXY= &&\
export HTTPS_PROXY= &&\
ng test --single-run --progress=false
Hope this helps those in trouble
EDIT : It's actually better to simply set a NO_PROXY env variable :
export NO_PROXY="localhost, 0.0.0.0/4201, 0.0.0.0/9876"
N.B : At first I used Chromium, and decided to switch to google-chrome latest versions because of protractor tests. I actually ran into @chrismwendt issue, and his little edit allowed me to find that my karma was using (I don't know how) a chromium bin env variable, even though I did set it correctly with the dockerfile !
The only fix is to re-set this env variable in my jenkins job as well :
# Set CHROME_BIN because it is incorrect even from Dockerfile
export CHROME_BIN=/usr/bin/google-chrome
@Tenmak
Thanks for your hint. That solved our problem too.
Can't believe it was the proxy setting... Thank you @Tenmak !!
@Tenmak it worked for me, thanks a lot !
this worked for me on the build server:
process.env.CHROME_BIN = require('puppeteer').executablePath(); browsers: ['Chrome'],
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 60000,
flags: [
'--disable-web-security',
'--disable-gpu',
'--no-sandbox'
]
I'm facing the same issue on build server, it works fine on local machine. tried multiple settings nothing helps. not sure why it fails on build server. is it a valid proxy settings ? doesnt work with this env variable.

My karma config settings,
browsers: ['ChromeNoSandbox'],
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 60000,
// reporters: ['progress', 'coverage'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: [
'--headless',
'--disable-gpu',
'--disable-translate',
'--disable-extensions',
'--no-sandbox',
'--remote-debugging-port=9222',
]
}
},
On my case I am suspecting that when I start chrome outside of karma, it output
DevTools listening on ws://127.0.0.1:9222/devtools/browser/85057d3a-17c3-455a-a50f-124c4f6f62ea
How do I disable the DevTools?
@Tenmak
...
Local headless chrome needed no proxy configuration in my case, hence :
export HTTP_PROXY= &&\ export HTTPS_PROXY= &&\ ng test --single-run --progress=falseHope this helps those in trouble
EDIT : It's actually better to simply set a NO_PROXY env variable :
export NO_PROXY="localhost, 0.0.0.0/4201, 0.0.0.0/9876"...
Saved my life!!! :)
Thank you lots!
Most helpful comment
I had the same issue, and it was not cause by either the
CHROME_BINbeing unset or incorrect, nor the chrome / chromium browser version; and even the--no-sandboxoption was not helping.The issue is that I needed to setup the proxy environment variables for my Jenkins job (run through a docker) to ensure
npmcould install dependencies, and I simply forgot to reset the environment variables once the dependencies were downloaded.Local headless chrome needed no proxy configuration in my case, hence :
Hope this helps those in trouble
EDIT : It's actually better to simply set a NO_PROXY env variable :
export NO_PROXY="localhost, 0.0.0.0/4201, 0.0.0.0/9876"N.B : At first I used Chromium, and decided to switch to google-chrome latest versions because of protractor tests. I actually ran into @chrismwendt issue, and his little edit allowed me to find that my karma was using (I don't know how) a chromium bin env variable, even though I did set it correctly with the dockerfile !
The only fix is to re-set this env variable in my jenkins job as well :