Browse files

added chromium support for devTools on linux

  Thanks for submitting a PR! Please read these instructions carefully:

  - [ ] Explain the **motivation** for making this change.
  - [ ] Provide a **test plan** demonstrating that the code is solid.
  - [ ] Match the **code formatting** of the rest of the codebase.
  - [ ] Target the `master` branch, NOT a "stable" branch.

  Please read the [Contribution Guidelines]( to learn more about contributing to React Native.

_What existing problem does the pull request solve?_

On Linux, the packager caught an "Google Chrome exited with error: { Error: spawn google-chrome ENOENT}" when trying to launch the devTools because google-chrome is not installed but chromium is.
Thus, this pull request maps the platform Linux with chromium for launching the debugger automatically in the packager

_A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website._

- enter on terminal
    > react-native start
- launch the app in dev mode with "Debug JS remotely" enabled
- the packager prints "Launching Dev Tools..." and launch chromium with the debugger
Closes #14696

Differential Revision: D5398564

Pulled By: hramos

fbshipit-source-id: 151f83b549492c8716a248eb16f7e24c5658b32e
  • Loading branch information...
retdop authored and facebook-github-bot committed Jul 11, 2017
1 parent a616a2d commit 3f16aa5559928d42903e2aa3b67a1b353c725603
Showing with 18 additions and 0 deletions.
  1. +18 −0 local-cli/server/util/launchChrome.js
@@ -11,13 +11,31 @@
'use strict';
const opn = require('opn');
const execSync = require('child_process').execSync;
function commandExistsUnixSync (commandName, callback) {
try {
var stdout = execSync('command -v ' + commandName +
' 2>/dev/null' +
' && { echo >&1 \'' + commandName + ' found\'; exit 0; }');
return !!stdout;
} catch (error) {
return false;
function getChromeAppName(): string {
switch (process.platform) {
case 'darwin':
return 'google chrome';
case 'win32':
return 'chrome';
case 'linux':
if (commandExistsUnixSync('google-chrome')) {
return 'google-chrome';
} else {
return 'chromium';
return 'google-chrome';

0 comments on commit 3f16aa5

Please sign in to comment.