title: Cannot start ChromeHeadless in Angular project using WSL, works on Mac
body: <p>I'm using Windows Subsystem for Linux (Windows 10, Ubuntu 18.04 LTS). I'll list all the other pertinent versions below. </p>
  
  <p>This setup is working on my Mac machine, without the <code>flags</code> array added to <code>karma.conf.ts</code> as shown below. </p>
  
  <p>So far I've looked at: </p>
  
  <p><a href="https://github.com/Codeception/CodeceptJS/issues/561#issuecomment-373666779" rel="noreferrer">Headless Chrome slows tests by 10x</a> </p>
  
  <p><a href="https://github.com/karma-runner/karma-chrome-launcher/issues/175" rel="noreferrer">Ubuntu: Cannot start ChromeHeadless</a></p>
  
  <p><a href="https://github.com/karma-runner/karma-chrome-launcher/issues/198" rel="noreferrer">Google Chrome 75.0.3770.80 HEADLESS no longer works inside Docker container</a></p>
  
  <p><a href="https://github.com/yarnpkg/yarn/issues/2069" rel="noreferrer">"rebuilding" yarn using <code>npm rebuild --update-binary</code></a></p>
  
  <p><a href="https://stackoverflow.com/questions/52700343/karma-test-with-angular-6">Karma Test With angular 6</a></p>
  
  <p><strong>Expected Behaviour</strong>
  To launch ChromeHeadless and run the tests</p>
  
  <p><strong>Current Behaviour</strong>
  Running <code>yarn test</code> as I would normally results in this error:</p>
  
  <pre><code>02 10 2019 09:13:03.598:ERROR [launcher]: ChromeHeadless stdout:
  02 10 2019 09:13:03.608:ERROR [launcher]: ChromeHeadless stderr: Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Permission denied
  Failed to generate minidump.
  02 10 2019 09:13:03.623:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-5419534
   21% building 99/100 modules 1 active ...ngenio/packages/web-app/src/styles.scss02 10 2019 09:13:03.699:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
  02 10 2019 09:13:03.702:DEBUG [launcher]: BEING_CAPTURED -&gt; RESTARTING
  02 10 2019 09:13:03.715:DEBUG [launcher]: RESTARTING -&gt; FINISHED
   22% building 100/101 modules 1 active ...project/packages/web-app/src/styles.scss02 10 2019 09:13:03.801:DEBUG [launcher]: Restarting ChromeHeadless
  02 10 2019 09:13:03.803:DEBUG [launcher]: FINISHED -&gt; BEING_CAPTURED
  02 10 2019 09:13:03.804:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-5419534
  02 10 2019 09:13:03.814:DEBUG [launcher]: google-chrome --user-data-dir=/tmp/karma-5419534 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate --disable-background-timer-throttling --disable-renderer-backgrounding --disable-device-discovery-notifications http://localhost:9876/?id=5419534 --headless --disable-gpu --remote-debugging-port=9222
   27% building 144/145 modules 1 active ...project/packages/web-app/src/styles.scss02 10 2019 09:13:05.142:DEBUG [launcher]: Process ChromeHeadless exited with code null and signal SIGILL
  02 10 2019 09:13:05.147:ERROR [launcher]: Cannot start ChromeHeadless
          Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Permission denied
  Failed to generate minidump.
  02 10 2019 09:13:05.159:ERROR [launcher]: ChromeHeadless stdout:
  02 10 2019 09:13:05.171:ERROR [launcher]: ChromeHeadless stderr: Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Permission denied
  Failed to generate minidump.
  02 10 2019 09:13:05.187:DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-5419534
   34% building 205/206 modules 1 active ...project/packages/web-app/src/styles.scss02 10 2019 09:13:05.679:ERROR [launcher]: ChromeHeadless failed 2 times (cannot start). Giving up.
  02 10 2019 09:13:05.680:DEBUG [launcher]: BEING_CAPTURED -&gt; FINISHED
  02 10 2019 09:13:13.587:DEBUG [karma-server]: List of files has changed, trying to execute
  02 10 2019 09:13:13.588:WARN [karma]: No captured browser, open http://localhost:9876/
  </code></pre>
  
  <p>and after <code>ctrl+c</code>...</p>
  
  <pre><code>An unhandled exception occurred: Cannot destructure property `error` of 'undefined' or 'null'.
  See "/tmp/ng-GhKvib/angular-errors.log" for further details.
  </code></pre>
  
  <p>The file <code>/tmp/ng-GhKvib/angular-errors.log</code> contains <code>An unhandled exception occurred: Cannot destructure property</code>error<code>of 'undefined' or 'null'.</code>.</p>
  
  <p><strong>Karma Config</strong></p>
  
  <pre><code>// karma.conf.ts
  
  module.exports = (config) =&gt; {
    config.set({
      basePath: '',
      frameworks: ['jasmine', '@angular-devkit/build-angular'],
      plugins: [
        require('karma-jasmine'),
        require('karma-chrome-launcher'),
        require('karma-jasmine-html-reporter'),
        require('karma-coverage-istanbul-reporter'),
        require('@angular-devkit/build-angular/plugins/karma'),
      ],
      client: {
        clearContext: false,
      },
      coverageIstanbulReporter: {
        dir: require('path').join(__dirname, './coverage/ng2angle'),
        reports: ['html', 'lcovonly', 'text-summary'],
        fixWebpackSourcePaths: true,
      },
      reporters: ['progress', 'kjhtml'],
      port: 9876,
      colors: true,
      logLevel: config.LOG_DEBUG,
      autoWatch: true,
      browsers: ['ChromeHeadless'],
      browserDisconnectTimeout: 10000,
      browserDisconnectTolerance: 3,
      browserNoActivityTimeout: 60000,
      flags: [
        '--disable-web-security',
        '--disable-gpu',
        '--no-sandbox',
        '--disable-features=NetworkService',
        '--proxy-server="direct://"',
        '--proxy-bypass-list=*',
        '--disable-dev-shm-usage',
      ],
      singleRun: false,
      restartOnFileChange: true,
    });
  };
  </code></pre>
  
  <p>The command that <code>yarn test</code> runs is <code>ng test --karmaConfig=karma.conf.ts</code>.</p>
  
  <p><strong>Versions</strong></p>
  
  <pre><code>yarn=1.19.0
  angular-cli=8.3.2
  karma=4.1.0
  karma-chrome-launcher=2.2.0
  tsc=2.7.2
  </code></pre>
  
  <h2>Edit</h2>
  
  <p>Eventually I just gave up on using Linux for this and am using Mac. Watch my <a href="https://github.com/karma-runner/karma-chrome-launcher/issues/214" rel="noreferrer">issue in the <code>karma-chrome-launcher</code> repo</a> for possible fixes in the future.</p>