Setting environment variable for CHROME_BIN does not work

后端 未结 8 1417
小鲜肉
小鲜肉 2020-12-30 22:47

I\'m trying to use Karma for testing my js scripts. In the doc it says I should set the environment variable for CHROME_BIN:

I\'ve set it to

相关标签:
8条回答
  • 2020-12-30 23:18

    I've found that installing Canary and changing browsers = ['Chrome']; to browsers = ['ChromeCanary']; is nicer.

    0 讨论(0)
  • 2020-12-30 23:23

    For Chromium in ubuntu 14.04 edit test/karma.conf.js and change

    browsers = ['Chrome'];
    

    for

    browsers = ['chromium-browser'];
    
    0 讨论(0)
  • In Powershell you can run the following command:

    $Env:CHROME_BIN = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    

    You need to replace the stuff within the double quotes with your local path.

    Or in cmd.exe

    SET CHROME_BIN = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    

    This is all you would need to get it going.

    0 讨论(0)
  • 2020-12-30 23:35

    Was facing the same issue and I solved it by editing the karma.conf.js and karma-e2e.conf.js files which is under config directory.

    Change:

    browsers = ['Chrome'];
    

    TO

    browsers = ['Your_System_Path_where_chrome_installed/chrome.exe'];
    

    in my case it was > C:/Program Files (x86)/Google/Chrome/Application/chrome.exe

    and then add C:\Program Files (x86)\Google\Chrome\Application\chrome.exe path to environment variables


    or in cmd

    SET CHROME_BIN = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
    

    Additional: Settings for other browsers can be seen here.

    And about why chrome one is not working I guess they(Karma) have configured their chrome path from some earlier versions of chrome.


    Update: For AngularJS tutorial Followers:

    • You still might face problems (as I faced) while running karma test runner on some tutorial steps and to resolve this: just add these "Angular Scenario Dependencies" in both the "...conf.js" files, like this:
    files = [
      ANGULAR_SCENARIO,
      ANGULAR_SCENARIO_ADAPTER,
        ....
        ....  // keep rest of the lines as it is
        ....
    ];
    
    0 讨论(0)
  • 2020-12-30 23:37

    (In Linux) I thought it was related to CHROME_BIN but in the end for me it had nothing to do with that variable and i removed it. I had to lookup the karma-chrome-launcher npm plugin on github and follow the instructions for adding no security to my karma config.

    0 讨论(0)
  • 2020-12-30 23:40

    I have solved the same issue by setting CHROME_BIN in my environment properties like this:

    c:/Program Files (x86)/Google/Chrome/Application/chrome.exe
    

    There have to be no double quotes (") around the property value and all backslash signs (\) have to be replaced by slash signs (/)

    0 讨论(0)
提交回复
热议问题