Karma - Chrome failed 2 times (cannot start). Giving up
I had the same problem and tried a lot of the suggested solutions I found, but what finally solved it for me was to delete the node_modules
folder and getting everything new via npm install
.
Had the same issue with my build environment.
What i did is to follow the advice of Rafael Cichocki to enable the debugging:
logLevel: config.LOG_DEBUG
Then tried to launch the chrome-browser with exactly the same line that was visible int he debug output.
Turned out that chrome browser was crashing due to missing ttf fonts. So running:
apt-get install ttf-freefont
Solved that issue for me and karma started to launch chrome.
browsers: ['PhantomJS']
, Here allowed browser is PhantomJs
, but code is trying for Chrome, which is not a specified browser in the karma.conf.js.
Change karma.conf.js
file :
browsers: ['PhantomJS','Chrome', 'ChromeHeadless']
,
chrome- is for opening new chrome browser window.
ChromeHeadless- is for running tests without opening browser window
make sure Chrome is installed and added to PATH
Hope this helps