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
What is the exact command you are executing?
@janpio the command is "ionic serve" inside my project
Please run ionic serve --verbose and post the whole output.
@janpio the output:
leonardo@coutinho-pc:~/3ionicprojects/cdm_admin$ ionic serve --verbose
[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$
(Add ```(newline) before and (newline)``` after to format better)
Thanks, this will help the devs.
@janpio thanks, any idea ?
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
The same error appear, but i think the problem is with app-scripts.
But i dont know the solution :'(
You might want to create an issue there (https://github.com/ionic-team/ionic-app-scripts/issues) as well, and link to this one.
@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.
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.
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:
npm run ionic:serve works good.npm install --save-dev --save-exact [email protected]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!
@dwieeb updated and it's all good, thanks.
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
@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.
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
@parvanova If you don't have that folder, then your error is different.
@leonardocoutinho Thanks man, It works for me.
Most helpful comment
@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.