ionic-cli icon indicating copy to clipboard operation
ionic-cli copied to clipboard

LiveReload not working

Open gabolucuy opened this issue 8 years ago • 22 comments

Description: Livereload does not load anything, it stays on white screen.

Steps to Reproduce: run "ionic serve" and select the app from the app "IonicDevApp" of Android

My ionic info: cli packages: (/home/gabo/Expanse Software/client app/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.6.0

System:

Android SDK Tools : 26.0.2
Node              : v6.12.0
npm               : 3.10.10 
OS                : Linux 4.10

Environment Variables:

ANDROID_HOME : /home/gabo/Android/Sdk/

Misc:

backend : pro

gabolucuy avatar Dec 03 '17 07:12 gabolucuy

I have the similar issue, my info: cli packages: (/Users/administrator/mobile/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0 

local packages:

@ionic/app-scripts : 3.1.5
Cordova Platforms  : android
Ionic Framework    : ionic-angular 3.9.2

System:

ios-deploy : 1.9.2 
ios-sim    : 6.1.2 
Node       : v8.8.1
npm        : 5.5.1 
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro 

asaratalafim avatar Dec 19 '17 18:12 asaratalafim

Same problem. Any solution?

mgleria avatar Jan 05 '18 16:01 mgleria

I resolved this by downgrading the socket: npm i -D -E [email protected]

asaratalafim avatar Jan 08 '18 15:01 asaratalafim

I resolved this by downgrading the socket: npm i -D -E [email protected]

It didn't work for me. The following error message is displayed on the console:

WebSocket connection to 'ws://localhost:35729/livereload' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

mgleria avatar Jan 10 '18 12:01 mgleria

@asaratalafim

worked for me, deeply thankful.

gdcruz9 avatar Mar 06 '18 06:03 gdcruz9

@gdcruz9 The ws solution is outdated and has been fixed in later versions of app-scripts. The correct solution to this problem is to install the latest app-scripts:

npm i -D @ionic/app-scripts@latest

imhoffd avatar Mar 06 '18 17:03 imhoffd

@dwieeb that didn't work for me. I built a clean instance of the tabs ionic template and then tried to reflect some basic changes on the home page without success.

I have the last version of app-scripts ( "@ionic/app-scripts": "^3.1.8") and the last version of IONIC CLI (3.19.1).

Any idea of why doesn't work livereload feature?

[UPDATE]: If I set a specific port for live-reload launching: ionic serve -r 35730 it works fine. Any plausible explanation for this behavior?

mgleria avatar Mar 12 '18 15:03 mgleria

@mgleria I don't know enough about your system. If you're on mac or linux, I'd say to run lsof -i :35730 and see what pops up. We can debug from there.

imhoffd avatar Mar 19 '18 23:03 imhoffd

@dwieeb thanks for your reply. It is really strange what is happening here. It works intermittently. It is working right now, and the command you suggest output is:

COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME 
chrome  5246 martin  134u  IPv4 214671      0t0  TCP localhost:59100->localhost:35729 (ESTABLISHED)
ionic   7146 martin   21u  IPv4  61273      0t0  TCP *:35729 (LISTEN)
ionic   7146 martin   28u  IPv4 211411      0t0  TCP localhost:35729->localhost:59100 (ESTABLISHED)

I'm on Linux (Ubuntu), and my ionic info command output is: cli packages: (/home/martin/.nvm/versions/node/v9.3.0/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v9.3.0
npm               : 5.5.1 
OS                : Linux 4.13

Environment Variables:

ANDROID_HOME : /home/martin/Android/Sdk/

Misc:

backend : pro

Do you notice something out of place?

mgleria avatar Mar 20 '18 14:03 mgleria

@mgleria The output of that command tells you which processes are operating on port 35730. You can use lsof -i :35729 to see the processes using the default livereload port. Can you also show me that output?

New ionic serve invocations should check for open ports, but there's clearly an issue with that on your system. That's what I'd like to debug.

imhoffd avatar Mar 20 '18 16:03 imhoffd

@dwieeb in my previous comment I left the output of lsof -i :35729 while ionic serve was running on the default port. I assume that information is not relevant now because it is working. If it fails again, I will look for the answers in the output of lsof -i :35729 and came back here if it is necessary. Thanks again for your willingness.

mgleria avatar Mar 21 '18 11:03 mgleria

Hi @dwieeb I have exactly the same issue with default port I run: lsof -i :35729

Google     317   JB  156u  IPv4 0x9641a155346fb105      0t0  TCP localhost:50204->localhost:35729 (ESTABLISHED)
Google     317   JB  172u  IPv4 0x9641a15534be3f95      0t0  TCP localhost:50199->localhost:35729 (ESTABLISHED)
Google     317   JB  182u  IPv4 0x9641a15534be23a5      0t0  TCP localhost:50198->localhost:35729 (CLOSE_WAIT)
node      1072   JB   29u  IPv4 0x9641a15534be2cf5      0t0  TCP *:35729 (LISTEN)
node      1072   JB   88u  IPv4 0x9641a15534bdfe65      0t0  TCP localhost:35729->localhost:50199 (ESTABLISHED)
node      1072   JB   89u  IPv4 0x9641a15532866e65      0t0  TCP localhost:35729->localhost:50204 (ESTABLISHED)
cli packages: (/usr/local/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 25.2.5
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.1
    Node              : v8.3.0
    npm               : 5.6.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/JB/Library/Android/sdk

Misc:

    backend : legacy

Can you help me with that information?

Regards!

jbgomez21 avatar Mar 23 '18 22:03 jbgomez21

@jbgomez21 So the quick fix is to use the kill command with the PID: kill 1072

@jbgomez21 @mgleria Have either of you switched between using the --local flag and excluding it? Or --address?

imhoffd avatar Mar 24 '18 02:03 imhoffd

I've tried with --address and writing my own IP address, but it didn't work. I also try with --local flag, but there was no difference in the behavior.

mgleria avatar Mar 26 '18 12:03 mgleria

@mgleria do you still have the issue?

gabolucuy avatar Apr 06 '18 01:04 gabolucuy

@gabolucuy yes, indeed. I can't figure out why and how to resolve it.

mgleria avatar Apr 09 '18 14:04 mgleria

@mgleria Would you mind testing out the CLI 4 RC? It uses a different technique for the app-scripts process and I'm curious (and hopeful) that it fixed it for you: npm i -g ionic@rc

imhoffd avatar Apr 09 '18 15:04 imhoffd

@mgleria recently I updated npm to the latest version and also I deleted the node_modules folder and run npm install again in the project. And livereload started working again. Hope this can help you!

gabolucuy avatar Apr 11 '18 18:04 gabolucuy

Thank you very much for responding and sorry for the delays in my answers.

@dwieeb I tried with CLI 4 RC and there are no changes.

@gabolucuy I renamed node_modules and after install CLI 4 RC I run npm install. My app is running ok, but livereload still does not work for me.

mgleria avatar Apr 13 '18 16:04 mgleria

@mgleria How frustrating! We check the livereload websocket port for active usage in the same way as the other ports. Is it always the websocket error you get?

imhoffd avatar Apr 13 '18 16:04 imhoffd