Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The app serving listener (ionic serve) stops working after making any code change #13668

Closed
Dellos7 opened this issue Dec 17, 2017 · 15 comments
Closed

Comments

@Dellos7
Copy link

Dellos7 commented Dec 17, 2017

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[x] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request

Please do not submit support requests or "How to" questions here. Instead, please use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

I have created a new blank ionic app, and then served it through browser. The app showed in browser correctly, however when I perform any code change, the live reload stops working triggering an error, and the app stops working, forcing me to reserving it again.

The following are JavaScript errors that I see in the browser console:

JavaScript console errors

GET http://localhost:8100/build/main.js net::ERR_CONNECTION_REFUSED ?ionicplatform=ios&ionicstatusbarpadding=true:52 GET http://localhost:8100/build/vendor.js net::ERR_CONNECTION_REFUSED ?ionicplatform=ios&ionicstatusbarpadding=true:48 GET http://localhost:8100/build/polyfills.js net::ERR_CONNECTION_REFUSED ?ionicplatform=ios&ionicstatusbarpadding=true:28 GET http://localhost:8100/cordova.js net::ERR_CONNECTION_REFUSED ?ionicplatform=ios&ionicstatusbarpadding=true:58 GET http://localhost:35729/livereload.js?snipver=1 net::ERR_CONNECTION_REFUSED VM342:164 WebSocket connection to 'ws://localhost:53703/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED WrappedWebSocket @ VM342:164 WrappedWebSocket @ VM361:164 openConnection @ ion-dev.js?v=3.1.5:101 start @ ion-dev.js?v=3.1.5:18 (anonymous) @ ion-dev.js?v=3.1.5:467 ?ionicplatform=windows:28 GET http://localhost:8100/cordova.js net::ERR_CONNECTION_REFUSED ?ionicplatform=windows:39 GET http://localhost:8100/build/main.css net::ERR_CONNECTION_REFUSED ?ionicplatform=windows:48 GET http://localhost:8100/build/polyfills.js net::ERR_CONNECTION_REFUSED ?ionicplatform=windows:52 GET http://localhost:8100/build/vendor.js net::ERR_CONNECTION_REFUSED ?ionicplatform=windows:55 GET http://localhost:8100/build/main.js net::ERR_CONNECTION_REFUSED ?ionicplatform=windows:58 GET http://localhost:35729/livereload.js?snipver=1 net::ERR_CONNECTION_REFUSED VM385:164 WebSocket connection to 'ws://localhost:53703/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED WrappedWebSocket @ VM385:164 WrappedWebSocket @ VM404:164 openConnection @ ion-dev.js?v=3.1.5:101 start @ ion-dev.js?v=3.1.5:18 (anonymous) @ ion-dev.js?v=3.1.5:467 ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:28 GET http://localhost:8100/cordova.js net::ERR_CONNECTION_REFUSED ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:39 GET http://localhost:8100/build/main.css net::ERR_CONNECTION_REFUSED ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:48 GET http://localhost:8100/build/polyfills.js net::ERR_CONNECTION_REFUSED ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:52 GET http://localhost:8100/build/vendor.js net::ERR_CONNECTION_REFUSED ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:55 GET http://localhost:8100/build/main.js net::ERR_CONNECTION_REFUSED ?ionicplatform=android&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab&http://localhost:8100/ionic-lab:58 GET http://localhost:35729/livereload.js?snipver=1 net::ERR_CONNECTION_REFUSED VM428:164 WebSocket connection to 'ws://localhost:53703/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED WrappedWebSocket @ VM428:164 WrappedWebSocket @ VM447:164 openConnection @ ion-dev.js?v=3.1.5:101 start @ ion-dev.js?v=3.1.5:18 (anonymous) @ ion-dev.js?v=3.1.5:467

The following are the errors that I get through the shell console:
Shell console errors

[OK] Development server running!
     Local: http://localhost:8100
     External: http://192.168.1.3:8100
     DevApp: ionic2-app-base@8100 on MacBook-Pro-de-David-2.local

[13:14:40]  lint finished in 5.99 s 
[13:14:54]  build started ... 
[13:14:54]  deeplinks update started ... 
[13:14:54]  deeplinks update finished in 14 ms 
[13:14:54]  template update started ... 
[13:14:54]  template update finished in 4 ms 
[13:14:54]  build finished in 26 ms 

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at exports._errnoException (util.js:1036:11)
    at TCP.onread (net.js:564:26)

Expected behavior:

The ionic serve command should reload the app with the new changes applied to the code, however it stops working.

Steps to reproduce:

ionic start myApp blank
ionic serve -l
Make code change.

Related code:

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

cli packages: (/usr/local/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 6.4.0 

local packages:

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

System:

    ios-deploy : 1.9.1 
    ios-sim    : 5.0.8 
    Node       : v6.7.0
    npm        : 5.6.0 
    OS         : macOS Sierra
    Xcode      : Xcode 9.1 Build version 9B55 

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : legacy
@wasiiim
Copy link

wasiiim commented Dec 17, 2017

Using ionic 2 and got the same error

@baraa-alkhatib
Copy link

I've noticed that previous projects work just fine unlike the newly generated ones where I have got the same problem upon saving (vscode) or refreshing the page (browser)

[03:31:13]  lint finished in 6.93 s
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:1024:11)
    at TCP.onread (net.js:615:25)

@baraa-alkhatib
Copy link

"update"

Alright guys I've tried this simple solution which works perfectly for me.., the problem seems to be in the new update for ws version 3.3.3. check it out in package-lock.json where

.
.
        "ws": "3.3.3",
.
.

     "ws": {
      "version": "3.3.3",
      "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz",
      "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==",
.
.
.

you can replace that with the previous version 3.3.2 and run npm install --save from the console..,

  1. replace the previous with the following:
.
.
        "ws": "3.3.2",
.
.

    "ws": {
      "version": "3.3.2",
      "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz",
      "integrity": "sha512-t+WGpsNxhMR4v6EClXS8r8km5ZljKJzyGhJf7goJz9k5Ye3+b5Bvno5rjqPuIBn5mnn5GBb7o8IrIWHxX1qOLQ==",
.
.
.
  1. run npm install --save from the console

.., that's it until they fix the bug with ws v3.3.4.

@pubudu-ranasinghe
Copy link

You can run npm install ws@3.3.2 for a temporary fix as suggested by @professphysics

@tawakol
Copy link

tawakol commented Dec 18, 2017

This worked for me, I went crazy because of this most of yesterday. Thanks for saving me today!

@kensodemann
Copy link
Member

Hello! Thank you for opening an issue with us!

I am going to close this as it is not an issue with the Ionic Framework.

Thank you for using Ionic

@boiss-dev
Copy link

boiss-dev commented Dec 18, 2017

yup ws change.. websockets/ws#1256

@lpinca
Copy link

lpinca commented Dec 18, 2017

@kensodemann there is no 'error' listener on the server client so the error is thrown and the process exits.

@kensodemann
Copy link
Member

@lpinca - Thank-you, but that is not Ionic Framework code. This issue list is only for the Ionic Framework. There might be a CLI issue open on this same topic. If you would like to see something changed in the CLI related to this you should raise that on the CLI's issue list, or issue a PR against the CLI fixing it.

@lpinca
Copy link

lpinca commented Dec 18, 2017

Got it, sorry about that, I wrongly assumed that the CLI was part of the Ionic Framework.

@kensodemann
Copy link
Member

@lpinca - that's cool. It is confusing as to what is what, we are working on making things less confusing in the future...

On the issue itself, though, I was just discussing this with someone internally, and we will likely pin the ws version in the short term and apply a better fix in the long term.

@lpinca
Copy link

lpinca commented Dec 18, 2017

@kensodemann whatever is better for you, you could just log the errors as you do when JSON parsing fails and eventually ignore socket errors but that's up to you.

@lpinca
Copy link

lpinca commented Dec 18, 2017

Just keep in mind that there are other errors that can be emitted, also on ws@<3.3.3, so pinning the version will not completely fix the issue.

@kensodemann
Copy link
Member

For anyone following this, I suggest following one of these issues where this is being worked on:

ionic-team/ionic-app-scripts#1345
ionic-team/ionic-cli#2921

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants