alexgorbatchev

Wednesday, March 12, 2014

Webstorm and Karma in Ubuntu 12 LTS

If you are attempting to run Karma unit tests from Webstorm in Ubuntu 12LTS you may run into the following error:
Cannot start Chrome
 Can not find the binary google-chrome
 Please set env variable CHROME_BIN
Attempting to export CHROME_BIN=/usr/bin/chromium-browser worked great for running karma from the command line, but did not fix my issue when running it from within Webstorm, so after a bit of searching I found that you can add environment variables to webstorm by editing the Run/Debug Configurations for Karma:
  1. Under Run > Edit Configurations...
  2. Select Karma > karma.conf.js 
  3. Add the Environment Variables:
    CHROME_BIN=<path to chromium-browser>
    • To find the location of chromium-browser:
      which chromium-browser