11

I have installed Cordova and built a basic app. The application is running fine in my android device. To make work easier, I was trying to run the Cordova browser platform. I ran the following commands in my project directory:

cordova platforms add browser
cordova run browser

The second command gives the following output:

Running command: /home/nitin/cordova_project/random_play/platforms/browser/cordova/run

but doesn't start any browser. I am using Ubuntu 14.04, and have google chrome installed. I, also killed all the running instances of chrome by running

pkill chrome

before running the cordova command. Could someone please tell me how I can fix this problem. Thank you.

6 Answers 6

13
  1. Install google-chrome on ubuntu/linux
  2. edit /platforms/browser/cordova/run
  3. add additional case statement for linux before ending "}"
  4. test with cordova run browser

Code:

case 'linux':
    spawn('google-chrome', ['--test-type', '--disable-web-security', '--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser', project]);
    break;
1
  • 2
    You are amazing.. How did you get to this? you are a geek. Commented Jun 18, 2015 at 10:38
13

I had a similar problem running cordova run browser. It said there was no google-chrome. Apparently this option works cordova run browser --target=firefox. I guess you can use the browser you want. I am using cordova 5.3.3.

10

I had a similar issue in Debian, where Chromium is the Chrome-like browser.

Doing

ln -s /usr/bin/chromium /usr/bin/google-chrome

solved the problem.

edit: in Ubuntu distros chromium is under /usr/bin/chromium-browser

1

I have Ubuntu 16.04, and the solution that @habakuck proposed worked for me. I do have a slight difference... I had to add "-browser" word to chromium:

ln -s /usr/bin/chromium-browser /usr/bin/google-chrome

Hope It helps someone :)

0

You can fix the problem using the patch described here: https://issues.apache.org/jira/browse/CB-7978. I'm quite disappointed that you still have to manually update files when the patch was released 6 months ago.

Another thing I had to do was using 'google-chrome' instead of 'chrome'. So instead of

var chromeProcess = spawn('chrome', args);

use

var chromeProcess = spawn('google-chrome', args);

Tried on cordova 4.3.0 and 5.0.0 and ubuntu 12.04. Hope this helps.

0

You can also install official Google Chrome browser - this should work out of the box

Not the answer you're looking for? Browse other questions tagged or ask your own question.