Ionic Serve crash on save

One would have to understand first what exactly is causing the error. Maybe compare the exact https requests sent to the “server” by the two different browser versions.

same as me. it work on safari

Yep, hope someone will be cleverer than me :slight_smile:

After a refresh it looks like this

Once server restarted and localhost:8100 app opened, I tried to call both “main.css” or “cordova.js” and in both case the result is the same as refresh, it breaks the server

Unfortunately, I have same problem after the install latest ionic CLI.

Also, chrome, opera is problem but safari works greatly.

There, https://github.com/parcel-bundler/parcel/issues/315#issuecomment-352280351, DeMoorJasper found a reason for the same error in another project

It looks like it’s linked with a websocket deprecation

1 Like

The following solution worked for me, downgrading the “ws” dependency used by @ionic/app-scripts version 3.1.5:

Remove node_modules folder and package-lock.json:

rm -dfr node_modules
rm package-lock.json

Create a file called npm-shrinkwrap.json on the same folder as package.json with the following contents:

{
  "dependencies": {
    "@ionic/app-scripts": {
      "version": "3.1.5",
      "from": "@ionic/app-scripts@3.1.5",
      "dependencies": {
        "ws": {
          "version": "3.3.2",
          "from": "ws@3.3.3"
        }
      }
    }
  }
}

Re-install node modules:

npm install
5 Likes

Should we then report an issue in app-scripts instead of CLI explaining that there is a workaround by downgrading ws / respectively that the problem may be there?

That would probably be a good idea.
Post the issue here as well, and all give it a :+1: on Github to make it known that this is important.

This did not solve the problem. I just tried this now my ionic info

@ionic/cli-utils : 1.14.0
ionic (Ionic CLI) : 3.14.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : none
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.9.3
npm  : 5.5.1
OS   : Windows 10

Misc:

backend : pro

@kolexinfos looks like you’re using older versions of Ionic packages. My solutions was for problems with the @ionic/app-scripts package version 3.1.5 that depends upon “ws” version “3.3.3”. I see you are using a lower version, perhaps you could open your package-lock.json and try to see if you have other packages with a dependency to the “ws” package. In case you need my ionic info to verify versions, please see 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.5.0 
    Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

local packages:

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

Here you go, that’s the issue to follow

P.S.: I already created and closed an issue today, didn’t wanted to open it again, thought it was much cleaner to create a new one…hope you think it’s too

7 Likes

Started happening for me too this morning. Glad I’m not alone.

in IE and Edge is working, not working on Chrome

Os projetos mais antigos do ionic 3 rodou normalmente no Google Chrome, já os novos projetos criados da erro ao atualizar a página ou sair do navegador. !

erro:

erro cmd log:

0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’,
1 verbose cli ‘C:\Users\adriano\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js’,
1 verbose cli ‘run’,
1 verbose cli ‘ionic:serve’ ]
2 info using npm@5.6.0
3 info using node@v6.11.4
4 verbose run-script [ ‘preionic:serve’, ‘ionic:serve’, ‘postionic:serve’ ]
5 info lifecycle myX@0.0.1~preionic:serve: myX@0.0.1
6 info lifecycle myX@0.0.1~ionic:serve: myX@0.0.1
7 verbose lifecycle myX@0.0.1~ionic:serve: unsafe-perm in lifecycle true
8 verbose lifecycle myX@0.0.1~ionic:serve: PATH: C:\Users\adriano\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Eddydata\ionic\myX\node_modules.bin;C:\Program Files (x86)\Common Files\Intel\Shared Files\cpp\bin\Intel64;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Git\cmd;C:\Program Files\nodejs;C:\Users\adriano\AppData\Local\Microsoft\WindowsApps;C:\Users\adriano\AppData\Roaming\npm;C:\Program Files\Microsoft VS Code\bin;C:\Users\adriano\AppData\Local\GitHubDesktop\bin
9 verbose lifecycle myX@0.0.1~ionic:serve: CWD: C:\Eddydata\ionic\myX
10 silly lifecycle myX@0.0.1~ionic:serve: Args: [ ‘/d /s /c’, ‘ionic-app-scripts serve’ ]
11 silly lifecycle myX@0.0.1~ionic:serve: Returned: code: 1 signal: null
12 info lifecycle myX@0.0.1~ionic:serve: Failed to exec ionic:serve script
13 verbose stack Error: myX@0.0.1 ionic:serve: ionic-app-scripts serve
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Users\adriano\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:285:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at EventEmitter.emit (events.js:191:7)
13 verbose stack at ChildProcess. (C:\Users\adriano\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:920:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
14 verbose pkgid myX@0.0.1
15 verbose cwd C:\Eddydata\ionic\myX
16 verbose Windows_NT 10.0.16299
17 verbose argv “C:\Program Files\nodejs\node.exe” “C:\Users\adriano\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js” “run” “ionic:serve”
18 verbose node v6.11.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error myX@0.0.1 ionic:serve: ionic-app-scripts serve
22 error Exit status 1
23 error Failed at the myX@0.0.1 ionic:serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Thank you for addressing this issue, Reed. Same issue with me - just started today. Running versions: Node 8.9.3, npm 5.5.1, and Ionic 3.19.0 - on Windows 10.

[21:21:22]  lint finished in 6.06 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)

Same problem. Started today as i foolishly updated ionic.
I just might have to REACT to this somehow…

LOL - I know it too well the “foolish” software update :slight_smile:

This work properly.
Thanks…

Guys! please run npm i -D -E ws@3.3.2 in your project’s path and the problem should be solved.
Thanks to @dertuerke for his answer: https://github.com/ionic-team/ionic-cli/issues/2921#issuecomment-352359738

20 Likes

It works for me… Greate !!!

previous my ws version was 3.2.0 and after upgrade it to version 3.3.2, the problem fixed. I don’t know the reason why…

Please tell me the steps you did @jongwons

Have to delete and npm install again after running this command npm i -D -E ws@3.3.2 ? @OmarSHussein