title: AngularJS npm test (Karma) remote server command line
body: <p>I am currently working through this AngularJS tutorial (<a href="https://docs.angularjs.org/tutorial/" rel="nofollow noreferrer">https://docs.angularjs.org/tutorial/</a>) and have encountered an interesting problem when attempting to run unit tests using 'npm test'. This is described at step 2 of the tutorial (<a href="https://docs.angularjs.org/tutorial/step_02" rel="nofollow noreferrer">https://docs.angularjs.org/tutorial/step_02</a>).</p>
  
  <p>My setup is as follows: </p>
  
  <ul>
  <li>host machine is Windows 10</li>
  <li>running a vagrant homestead box (<a href="https://laravel.com/docs/4.2/homestead" rel="nofollow noreferrer">https://laravel.com/docs/4.2/homestead</a>)</li>
  <li>use Putty to ssh into my box, e.g. to install npm</li>
  <li>use mapped/shared vagrant folders to do coding in my Win10 environment</li>
  <li>use Firefox/Chrome on host machine to view website (<a href="http://192.168.10.10/angular-phonecat/app/" rel="nofollow noreferrer">http://192.168.10.10/angular-phonecat/app/</a>)</li>
  </ul>
  
  <p>Problem:
  The tutorial discusses unit tests and says to execute these with 'npm test' command. This will trigger the opening of either the Chrome or Firefx browser and then run the tests. So far so good. But: when I run the 'npm test' command in my Putty ssh shell, there is (obviously) no Chrome or FF browser window that can be opened. Hence, I get this error:</p>
  
  <pre><code>vagrant@homestead:~/Code/angular-phonecat$ npm test
  
  &gt; angular-phonecat@0.0.0 pretest /home/vagrant/Code/angular-phonecat
  &gt; npm install
  
  npm WARN install:nopt@3.0.6 EPROTO: protocol error, symlink '../nopt/bin/nopt.js' -&gt; '/home/vagrant/Code/angular-phonecat/node_modules/.bin/nopt'
  
  &gt; angular-phonecat@0.0.0 postinstall /home/vagrant/Code/angular-phonecat
  &gt; bower install
  
  
  &gt; angular-phonecat@0.0.0 test /home/vagrant/Code/angular-phonecat
  &gt; node node_modules/karma/bin/karma start test/karma.conf.js
  
  INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
  INFO [launcher]: Starting browser Chrome
  ERROR [launcher]: No binary for Chrome browser on your platform.
    Please, set "CHROME_BIN" env variable.
  INFO [launcher]: Starting browser Firefox
  ERROR [launcher]: Cannot start Firefox
  
  INFO [launcher]: Trying to start Firefox again (1/2).
  ERROR [launcher]: Cannot start Firefox
  
  INFO [launcher]: Trying to start Firefox again (2/2).
  ERROR [launcher]: Cannot start Firefox
  
  ERROR [launcher]: Firefox failed 2 times (cannot start). Giving up.
  </code></pre>
  
  <p>Note that this is not the same as the types of problems reported in these posts:</p>
  
  <p><a href="https://stackoverflow.com/questions/16017896/setting-environment-variable-for-chrome-bin-does-not-work">Setting environment variable for CHROME_BIN does not work</a></p>
  
  <p><a href="https://stackoverflow.com/questions/18924263/how-to-fix-error-please-set-env-variable-chrome-bin-when-running-angular-js-wi">How to fix error &quot;Please set env variable CHROME_BIN&quot; when running Angular.js with grunt</a></p>
  
  <p>These posts (and there may be others) assume that the npm test tool (Karma?) is used on a Windows machine, which has Chrome and FF installed. But I am remotely logging on to a Ubuntu machine, which has FF installed and the FIREFOX_BIN environment variable set correctly (/usr/bin/firefox), but cannot open a visual windows because I am looged on through a commnd line shell.</p>
  
  <p>So, my question is: how can I use npm test (or Karma) to run my unit tests using the setup described above?</p>
  
  <p>Unfortunately I don't know how to ask my question or state the problem any better than this, so if you need any other details to help me, please let me know.</p>
  
  <p>Thanks
  AHL</p>