How to get Karma to work with Chrome How to get Karma to work with Chrome google-chrome google-chrome

How to get Karma to work with Chrome


I'll expand on Ludwig's third point for answer seekers and for my own reference in the future...

The first thing you need to do is find where chromium-browser is installed. Run:

which chromium-browser

This will return the path to the executable, which will look something like this:

/usr/bin/chromium-browser

Then simply set the path:

export CHROME_BIN=/usr/bin/chromium-browser

Now Karma can find the browser it needs to execute your tests (assuming you've decided to use a graphical interface).


  1. If you only have a command-line interface, PhantomJS is the only choice for you.
  2. In linux (at least 12.04 and forwards) chromium is the alternative. But you can't install it if you don't have a graphical ui.
  3. The clue is here: "Please set env variable CHROME_BIN". Karma tries to execute a file called google-chrome and it does not exist. The name of the executable for chrome varies from OS to OS. Therefore you need to set an enviroment variable called CHROME_BIN which has the value of the name of your chrome executable. On my system (Linux desktop 13.10) this is chromium-browser.


My solution is to create an alias in linux to windws's chrome

alias launchchrome="\"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe\""

and after that export that alias as linux env variable

export CHROME_BIN=launchchrome

That's it, now if you run ng test your windows chrome will be used! In my particular case this solution worked