Live reload is not working with Ionic serve command
Asked Answered
H

6

6

As per the Ionic Guide Chapter 4 http://ionicframework.com/docs/guide/testing.html, ionic serve will start a live reload server, which it does in my case, but reload is not happening.

Is there any pre-req we need to have for this thing to work? Like say live reload chrome extension?

E:\Ionic\myapp>ionic serve
Running dev server: http://localhost:8100
Running live reload server: http://localhost:35729
Harvin answered 19/8, 2014 at 20:35 Comment(1)
check if its injecting a script into your page,should be something like <script src="192.168.0.1:35729/livereload.js?snipver=1"></script>. If there is a script it shouldn't need the extension, and all should be working fine.Vendor
S
7

Here is what worked for me:

  • stop ionic service if you running it 'q' command
  • run: ionic address from command prompt

After running this command it will prompt you to select what address you would like to use one is localhost and the second one is your machine IP address. Try to use select your machine IP address instead of localhost.

Smackdab answered 10/3, 2015 at 13:28 Comment(0)
T
2

Even I faced similar issue, console used to display the file changed but automatic browser refresh wasn't happening. Later I found out a missing closing tag in my index.html page that prevented ionic to inject the below script required for live reload.

    <script src="//localhost:35729/livereload.js?snipver=1"></script>

Please check for any typo errors or other html issues in the index.html page and fix those. Live reload should word properly after that.

Tanning answered 18/2, 2015 at 16:45 Comment(0)
A
2

In Ionic 2/3, I solved this problem by removing the folder node_modules/ and file package-lock.json, then at terminal run: npm install --save

Amalgamation answered 18/7, 2017 at 6:53 Comment(0)
M
0

I'm my case, I was bootstraping the app with this:

window.ionic.Platform.ready(function() {
 angular.bootstrap(document, ['myApp']);
});

Then I changed it for this:

<body ng-app="myApp" >
   <ion-nav-view></ion-nav-view>
</body>

And it works

Monophonic answered 24/11, 2016 at 13:13 Comment(0)
G
0

if you want to get Live console logs in the ionic application (real device or emulator)

ionic cordova run android --livereload  --consolelogs --serverlogs
Giantess answered 12/1, 2021 at 18:3 Comment(0)
T
0

In my case I had the web app already running localhost:8100 for deskotp development which caused the app to not load on the phone. Running npm ionic cap run --livereload will run a server for the desktop to access too.

Tripartite answered 10/10, 2024 at 17:21 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.