5
votes

I tried to use live reload feature with ionic serve and ionic emulate ios --livereload. Server starts well, application is displayed on simulator (or in browser) and it works smoothly.

When I change a file (a js or html in www directory) and save it, console write HTML changed: www/index.html for example, but application doesn't reload itself as it should be.

I supposed that websocket between server and app could be broken, but when I kill the server (Ctrl-C), web inspector immediatly fire the following error : [Error] WebSocket network error: The operation couldn’t be completed. Connection refused (192.168.5.2, line 0, x4)

So I supposed that there is no issue with websocket. Moreover, it is displayed with no error in Network pane of web inspector.

Is there something I missed to made livereload work ?

My configuration :

  • Cordova CLI: 5.0.0
  • Ionic Version: 1.0.0
  • Ionic CLI Version: 1.4.5
  • Ionic App Lib Version: 0.0.22
  • ios-deploy version: 1.7.0
  • ios-sim version: 3.1.1
  • OS: Mac OS X Yosemite
  • Node Version: v0.10.30
  • Xcode version: Xcode 6.3.2 Build version 6D2105

Don't hesitate to ask me for clarification if something is not clear.

Edit

I also tested it without Internet connection at all to check if it was a firewall issue or something like that, but it changes nothing.

3

3 Answers

1
votes

Try running ionic address and selecting the correct interface.

If it doesn't work and it's iOS 9, it may be an issue with Apple ATS:

https://github.com/driftyco/ionic-cli/issues/605

It could also be a CORS issue. In this case, try installing the cordova-white-list plugin.

0
votes

I solved this doing this:

Go to https://update.ionic.zone/

Copy the content of your package.json in the input tab.

Then click in the update button

Copy the content of the output tab and paste replacing the content of your package.json

Save the file, and run npm install

When the updates are finish just run ionic serve and it should be works fine again

;)

0
votes

I have faced such a problem, tried a fresh new app, worked perfectly, tried another old app, also worked perfectly.

Tried to stop using some modules (clipboard in my case and another one), solved the problem, in my case it was an error in the way I am importing or using it.

Hope this will help someone