Ionic serve --lab don't work in RC2

after i just upgrade my ionic from beta to RC i am unable to use ionic serve --lab,
this error is showing on browser “Cannot GET //__ion-dev-server/ionic_lab.html”

1 Like

and when i run on my android phone with “ionic run android --device --livereload”. the livereload seems not functioning at all…everytime i change my code i still need to rebuild to see the changes.

I am also getting this same issue with the “Cannot GET //__ion-dev-server/ionic_lab.html” error whenever I try to run labs. I have a fresh install of everything and have started a new blank project.

waiting someone who can solve this issues

the same problem with me.
[root@localhost MyIonic2Project]# ionic info
My system information:
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.1.0
Xcode version: Not installed

pls help me .

I had the same issue so I decided to remove the ionic: from the scripts section and just leave build, serve and watch.

My scripts section now looks like this :

"build": "ionic-app-scripts build",
"serve": "ionic-app-scripts serve",
"watch": "ionic-app-scripts watch"

That works for me now but not sure if it is the correct final solution.

To get live reload working on run you can add this to your scripts section :

“run:before”: “watch”

Make sure that you also have watch defined in your scripts so :

“watch”: “ionic-app-scripts watch”

If you want to have live reload work for emulate, you will need this in your scripts section :

“emulate:before”: “watch”

Having the same issue…

Where do I find that section now? That looks similar to the previous used gulp, but I can’t find it.
Sorry for maybe stupid question :wink:

This is in your package.json. You should see a section called “scripts”.

Mine has the following in there:

“scripts”: {
“build”: “ionic-app-scripts build”,
“watch”: “ionic-app-scripts watch”,
“serve:before”: “watch”,
“emulate:before”: “watch”,
“deploy:before”: “build”,
“build:before”: “build”,
“run:before”: “watch”


this method solve my problem…now i can use ionic serve --lab…thanks

sometime when you modify the scss file and save…the serve page will have problem of losing all css file and you have to refresh to fix it…

package.json and remove “ionic:serve”

“scripts”: { “ionic:build”: “ionic-app-scripts build”, “ionic:serve”: “ionic-app-scripts serve” },

Remove “ionic:serve”

“scripts”: { “ionic:build”: “ionic-app-scripts build” },

1 Like

Thank you for this solution. Been trying to figure this out all weekend.

I know this might be a bit to much, but can you please explain what your script is doing and why the default ones didn’t work (shown below)
scripts": {
“ionic:build”: “ionic-app-scripts build”,
“ionic:serve”: “ionic-app-scripts serve”

Thanks again for the magical working script!!!

To be honest, I didn’t dig further as to why the defaults were not working. I have a TODO for this weekend to figure out why exactly. I can only assume it is a bug introduced with RC2 but will confirm this weekend.

In terms of the pieces I added, that just adds before events to each action so in this case, allows us to setup watch before we serve or emulate or run so we can have live reloading again.

1 Like

Thank you so much. You really saved me 3 days of debugging.

I’m still very new at all of this + npm scripts. I’m reading on npm scripts now and learning about the before thing.
If you are able to figure it out this weekend, I would love if you could break it down for the rest of us.

Do you by any chance know what happens when we run ionic serve?
Does it just go down the script section doing those things one by one?

The package.json just instructs what needs to run when you call a specific command or what needs to run before.

This in turn will most likely execute the scripts found in node_modules@ionic\app-scripts\dist which contains the scripts for build, watch, serve etc.

1 Like

@stwelgemoed you sir are fantastic.
Thank you.

I upgraded everything to latest yesterday and set my scripts to:

"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"ionic:watch": "ionic-app-scripts watch"

and ionic serve --lab works again.

ionic -v gives me 2.1.12
My project app-script dependency is: "@ionic/app-scripts": "0.0.46"

hi, I am also facing this problem… ionic serve --lab not working , any suggestion??

       "scripts": {
          "ionic2-custom-icons": "ionic2-custom-icons",
          "build:before": "ionic2-custom-icons",
          "serve:before": "ionic2-custom-icons",
          "ionic:build": "ionic-app-scripts build",
          "ionic:serve": "ionic-app-scripts serve"

ionic info:

   Cordova CLI: 6.4.0 
   Ionic Framework Version: 2.0.0-rc.4
   Ionic CLI Version: 2.1.18
   Ionic App Lib Version: 2.1.9
   Ionic App Scripts Version: 0.0.48
   ios-deploy version: Not installed
   ios-sim version: Not installed
   OS: Linux 4.8
   Node Version: v7.2.1
   Xcode version: Not installed

I’m having the same problem with this ionic info:

Cordova CLI: 6.5.0 
Ionic Framework Version: 2.0.0-rc.5
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v4.2.6
Xcode version: Not installed

Any solution? Thx!