Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ionic serve dont serve the app on the browser #2620

Closed
leonardocoutinho opened this issue Aug 8, 2017 · 19 comments
Closed

Ionic serve dont serve the app on the browser #2620

leonardocoutinho opened this issue Aug 8, 2017 · 19 comments

Comments

@leonardocoutinho
Copy link

Hello.
Ionic serve command gives an error: TypeError: Cannot read property 'launchBrowser' of undefined.
I cant use my app on the browser or device.

My Ionic Info

@ionic/cli-plugin-cordova       : 1.6.2
@ionic/cli-plugin-ionic-angular : 1.4.1
@ionic/cli-utils                : 1.7.0
ionic (Ionic CLI)               : 3.7.0

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.6.0

System:

Node : v6.10.3
OS   : Linux 4.4
npm  : 3.10.10 
@janpio
Copy link
Contributor

janpio commented Aug 8, 2017

What is the exact command you are executing?

@leonardocoutinho
Copy link
Author

@janpio the command is "ionic serve" inside my project

@janpio
Copy link
Contributor

janpio commented Aug 8, 2017

Please run ionic serve --verbose and post the whole output.

@leonardocoutinho
Copy link
Author

leonardocoutinho commented Aug 8, 2017

@janpio the output:

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/home/leonardo/3ionicprojects/cdm_admin', local: true, binPath:
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath:
        '/home/leonardo/3ionicprojects/cdm_admin/node_modules/ionic/dist/index.js' }
[DEBUG] Loading local plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for local @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
[DEBUG] Getting plugin info for ionic
[DEBUG] Checking for latest plugin version of ionic@latest.
[DEBUG] Getting plugin info for @ionic/cli-plugin-cordova
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-cordova@latest.
[DEBUG] Getting plugin info for @ionic/cli-plugin-ionic-angular
[DEBUG] Checking for latest plugin version of @ionic/cli-plugin-ionic-angular@latest.
[DEBUG] Daemon found (pid: 3977)
[INFO] Starting app-scripts server: --log-level debug --port 8100 --p 8100 --livereload-port 35729 --r 35729 --address
       localhost - Ctrl+C to cancel
TypeError: Cannot read property 'launchBrowser' of undefined
[DEBUG] TypeError: Cannot read property 'launchBrowser' of undefined
        at onReady (/home/leonardo/3ionicprojects/cdm_admin/node_modules/@ionic/app-scripts/dist/serve.js:70:15)
        at /home/leonardo/3ionicprojects/cdm_admin/node_modules/@ionic/app-scripts/dist/serve.js:63:13
        at process._tickCallback (internal/process/next_tick.js:109:7)
leonardo@coutinho-pc:~/3ionicprojects/cdm_admin$  ```

@janpio
Copy link
Contributor

janpio commented Aug 8, 2017

(Add ```(newline) before and (newline)``` after to format better)

Thanks, this will help the devs.

@leonardocoutinho
Copy link
Author

@janpio thanks, any idea ?

@janpio
Copy link
Contributor

janpio commented Aug 8, 2017

No. Try adding the -b parameter to not launch a browser, but this is just because it has a similar name to your error message :p

@leonardocoutinho
Copy link
Author

The same error appear, but i think the problem is with app-scripts.
But i dont know the solution :'(

@janpio
Copy link
Contributor

janpio commented Aug 8, 2017

You might want to create an issue there (https://github.com/ionic-team/ionic-app-scripts/issues) as well, and link to this one.

@synga
Copy link

synga commented Aug 9, 2017

@leonardocoutinho try npm run ionic:serve. I've seen many people asking about ionic serve not working, it may be something with the new 3.7.0 CLI because app-scripts serve via npm run works fine. But try this command and see if it works for you.

@leonardocoutinho
Copy link
Author

Hello @synga i just downgrade the ionic version from 3.6.0 to 3.5.0, and works fine.
In the future if i had the same error i will try your solution.
Thanks.

@twltony
Copy link

twltony commented Aug 14, 2017

I get the same issue with upgrading ionic version to 3.7.0, but works fine with 3.6.0.

[DEBUG] CLI flags: { interactive: true, confirm: false } [DEBUG] { cwd: '/Users/Tony/Documents/ion2', local: true, binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/Users/Tony/Documents/Nimble/01workspace/ion2/node_modules/ionic/dist/index.js' } [DEBUG] Loading local plugin @ionic/cli-plugin-proxy [DEBUG] Throwing PLUGIN_NOT_INSTALLED for local @ionic/cli-plugin-proxy [DEBUG] Loading local plugin @ionic/cli-plugin-cordova [DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular [DEBUG] New daemon pid: 44719 [DEBUG] Getting plugin info for ionic [DEBUG] Checking for latest plugin version of ionic@latest. [DEBUG] Getting plugin info for @ionic/cli-plugin-cordova [DEBUG] Checking for latest plugin version of @ionic/cli-plugin-cordova@latest. [DEBUG] Getting plugin info for @ionic/cli-plugin-ionic-angular [DEBUG] Checking for latest plugin version of @ionic/cli-plugin-ionic-angular@latest. [INFO] Starting app-scripts server: --log-level debug --port 8100 --p 8100 --livereload-port 35729 --r 35729 --address localhost - Ctrl+C to cancel TypeError: Cannot read property 'launchBrowser' of undefined [DEBUG] TypeError: Cannot read property 'launchBrowser' of undefined at onReady (/Users/Tony/Documents/Nimble/01workspace/ion2/node_modules/@ionic/app-scripts/dist/serve.js:70:15) at /Users/Tony/Documents/Nimble/01workspace/ion2/node_modules/@ionic/app-scripts/dist/serve.js:63:13
workaround:

  1. Trying the command @synga post. npm run ionic:serve works good.
  2. Or you can try to downgrade ion-cli verion from 3.7.0 to 3.6.0 by this command npm install --save-dev --save-exact [email protected]

@imhoffd
Copy link
Contributor

imhoffd commented Aug 14, 2017

Hi all, this was a bug introduced in CLI 3.7 that I've fixed with 3.8 (just released). Please give it a try and let me know if you have any issues! Sorry about that!

@imhoffd imhoffd closed this as completed Aug 14, 2017
@synga
Copy link

synga commented Aug 15, 2017

@dwieeb updated and it's all good, thanks.

@parvanova
Copy link

Hi
I have just updated to 3.8.1 but this doesn't fix the problem
node - 8.2.1
npm 5.3.0
ionic 3.8.1
Ubuntu 14.04 LTS

imhoffd added a commit to ionic-team/ionic-app-scripts that referenced this issue Aug 15, 2017
@imhoffd
Copy link
Contributor

imhoffd commented Aug 15, 2017

@parvanova I believe the commit above ^ will fix your issue, but I also believe there is an underlying error you're getting that's not surfacing.

@parvanova
Copy link

parvanova commented Aug 15, 2017

sorry for the dummy question but how do I apply this commit. I don't even have such file in node_modules/@ionic/app_scripts
And if I have an underlying error how do I get it?

Thanks

@imhoffd
Copy link
Contributor

imhoffd commented Aug 15, 2017

@parvanova If you don't have that folder, then your error is different.

@jayeshdhage07
Copy link

@leonardocoutinho Thanks man, It works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants