Cordova run browser not working Ubuntu 14.04
Asked Answered
H

6

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.

Heaviside answered 19/4, 2015 at 13:27 Comment(0)
R
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;
Reproachful answered 26/5, 2015 at 20:54 Comment(1)
You are amazing.. How did you get to this? you are a geek.Renvoi
S
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.

Schizophyceous answered 20/10, 2015 at 15:24 Comment(0)
C
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

Corsetti answered 16/10, 2015 at 12:18 Comment(0)
D
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 :)

Dorwin answered 26/10, 2016 at 2:24 Comment(0)
K
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.

Kerrin answered 4/5, 2015 at 12:24 Comment(0)
T
0

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

Treen answered 21/1, 2016 at 12:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.