Live reload is not working with Ionic serve command

别来无恙 提交于 2019-12-05 10:07:50

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.

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.

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

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!