[v2] ionice run ios --live-reload not reloading on file change
The issue: When I run my project with live-reload the emulator/device is not being updated when I change my source files.
ionic run ios -c --live-reload
Running 'run:before' gulp task before run
[14:26:39] Starting 'clean'...
[14:26:39] Finished 'clean' after 20 ms
[14:26:39] Starting 'build'...
[14:26:39] Starting 'sass'...
[14:26:39] Starting 'html'...
[14:26:39] Starting 'fonts'...
[14:26:39] Starting 'scripts'...
[14:26:39] Finished 'scripts' after 67 ms
[14:26:39] Finished 'html' after 103 ms
[14:26:39] Finished 'fonts' after 110 ms
[14:26:40] Finished 'sass' after 928 ms
[14:26:55] Finished 'build' after 16 s
[14:26:55] Starting 'run:before'...
[14:26:55] Finished 'run:before' after 6.7 μs
Setup Live Reload
Running live reload server: http://10.0.0.120:35729
Watching: www/**/*, !www/lib/**/*
√ Running dev server: http://10.0.0.120:8100
Ionic server commands, enter:
restart or r to restart the client app from the root
goto or g and a url to have the app navigate to the given url
consolelogs or c to enable/disable console log output
serverlogs or s to enable/disable server log output
quit or q to shutdown the server and exit
Now, if I change anything in my project (let's say app/app.ts) the emulator/device does not reload.
I think it's because the 'watch' task in gulp is not being run.
Workaround If I open another terminal window and run this command in my project folder, live reload works as expected:
gulp watch
[14:31:28] Using gulpfile ~/ionic/ionic-projects/PortalShopApp/gulpfile.js
[14:31:28] Starting 'clean'...
[14:31:28] Finished 'clean' after 18 ms
[14:31:28] Starting 'watch'...
[14:31:28] Starting 'sass'...
[14:31:28] Starting 'html'...
[14:31:28] Starting 'fonts'...
[14:31:28] Starting 'scripts'...
[14:31:28] Finished 'scripts' after 80 ms
[14:31:28] Finished 'html' after 109 ms
[14:31:28] Finished 'fonts' after 109 ms
[14:31:29] Finished 'sass' after 1.19 s
7.3 MB bytes written (11.42 seconds)
[14:31:43] Finished 'watch' after 15 s
[14:31:55] Starting 'html'... <--- I changed app/pages/login/login.html and it started 'html' task like expected
[14:31:55] Finished 'html' after 12 ms
This should happen automatically, right?
Okay, I figured it out!
I used parameter --live-reload instead of --livereload. When using the correct parameter it starts the watch task (like defined in gulpfile.js).
The live reload server should probably not be set up when using --live-reload (the wrong parameter) since it won't behave as expected since the watch task is not started.
Thanks for the issue! I agree, either the starters should check for live-reload by default or live-reload should not be a supported flag.
Have the same issue in the emulate command. The changes I make in the app folder are not updated.
I run the command
$ ionic emulate ios --livereload --address localhost --consolelogs --serverlogs
Nothing is updated. I then have to open a new terminal and run the command
$ gulp watch
Then all updates are processed correctly.
$ ionic info
Your system information:
Cordova CLI: 6.3.0
Gulp version: CLI version 3.9.1
Gulp local:
Ionic CLI Version: 2.0.0-beta.35
Ionic App Lib Version: 2.0.0-beta.19
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.3.0
Xcode version: Xcode 7.3.1 Build version 7D1014
Could you try using run instead of emulate? I think I remember something about emulate not working with livereload param. It will still load in an emulator if no devices are attached.
run works!
When I run the following command, the app starts on my iphone but it does not reload the app after I change the code:
ionic run ios -l
here are my ionic info:
Cordova CLI: 6.3.1 Gulp version: CLI version 3.9.0 Gulp local: Local version 3.9.1 Ionic Framework Version: 2.0.0-beta.11 Ionic CLI Version: 2.0.0 Ionic App Lib Version: 2.0.0 ios-deploy version: 1.9.0 ios-sim version: 5.0.8 OS: Mac OS X El Capitan Node Version: v6.3.1 Xcode version: Xcode 8.0 Build version 8A218a
Does anyone experience the same issue?
Cordially,
Herve
@jsappme Same problem here
+1
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.42 ios-deploy version: 1.9.0 ios-sim version: 5.0.11 OS: OS X El Capitan Node Version: v7.0.0 Xcode version: Xcode 8.1 Build version 8B62
@filipsuk Can you paste the command you are executing as well as your scripts content within package.json?
It's 2017 and I have the same issue
Output of ionic info is:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.0.0
ios-deploy version: 1.9.0
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.5.0
Xcode version: Xcode 8.1 Build version 8B62
The command I use is
ionic emulate ios -c -s -l --debug
+1
Cordova CLI: 6.5.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
ios-deploy version: 1.9.1
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v4.8.1
Xcode version: Xcode 8.2.1 Build version 8C1002
Same here
Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.43
ios-deploy version: 1.9.1
ios-sim version: 5.0.6
OS: macOS Sierra
Node Version: v7.6.0
Xcode version: Xcode 8.1 Build version 8B62
Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.
Thank you for using Ionic!