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

Error: read ECONNRESET #315

Closed
bradtraversy opened this issue Dec 17, 2017 · 25 comments
Closed

Error: read ECONNRESET #315

bradtraversy opened this issue Dec 17, 2017 · 25 comments

Comments

@bradtraversy
Copy link

Hello, I am trying to get started with Parcel. I created an index.html file with an index.js and when I run

parcel index.html

localhost:1234 opens fine but as soon as I save the file the server stops and I get

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

Error: read ECONNRESET
    at _errnoException (util.js:999:13)
    at TCP.onread (net.js:629:25)
@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 17, 2017

Is there any more errors on the bundler side?
Or is this the bundler side?
Could u specify in a bit more detail what you did/fill in the bug report form, so we can reproduce this issue and debug it

@JounQin
Copy link

JounQin commented Dec 17, 2017

It seems an issue of ws@3.3.3, downgrade and lock ws@3.3.2 works to me.

Related: BoltDoggy/parcel-plugin-vue#4 (comment)

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 17, 2017

Thanks for looking into this, i'll dive into this a bit and report what i found or do a PR

EDIT: Confirmed using WS 3.3.3

@DeMoorJasper
Copy link
Member

Pinpointed the situation, it had to do with an error that got added to ws (when user disconnects while sending), This gets triggered every time the websocket triggers a html reload (if u edit a html file)
I'll do a PR with a bugfix in a bit

@chasegiunta
Copy link

Am I wrong or does this bug completely break Parcel in dev at the moment? Wanted to get check out Parcel today but crashes on every change.

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 17, 2017

It breaks the moment you change html files @chasegiunta

@chasegiunta
Copy link

For me, it's breaking just upon reloading a page that is including the output. No html file change needed.

I'm running parcel src/main.js -d web/dist, and including only <script src="/dist/main.js"></script> on my page.

@DeMoorJasper
Copy link
Member

Than it's affecting more people than expected, i'll do my best to speedup getting the PR through

@peterpeterparker
Copy link

peterpeterparker commented Dec 17, 2017

So, I landed here because I was googling the same today's error output (ionic project) ionic-team/ionic-cli#2921

@DeMoorJasper are you facing that issue only with Chrome too?
Did you find any lead to solve it? something linked with websocket?

@DeMoorJasper
Copy link
Member

@peterpeterparker look at PR #320
It had to do with page reloads disconnecting the client websocket from the server, which resulted in ECONNRESET, it used to be ignored in WS 3.3.2 that's why it just became an error after the update...

@peterpeterparker
Copy link

@DeMoorJasper neat, thx for pointing that out 👍

@mririgoyen
Copy link

mririgoyen commented Dec 17, 2017

I'm hear to report I'm having a very similar issue. I can start the parcel server, but I see this when it is starting...

yarn run v1.3.2
$ parcel -p 3000 ./public/index.html
⏳  Building...
Server running at http://localhost:3000 - configured port 3000 could not be used.

However, when I go to http://localhost:3000, the app responds. If I change any files, I see the changes happen. The second I refresh the page though, I get...

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

Error: read ECONNRESET
at _errnoException (util.js:1024:11)
at TCP.onread (net.js:615:25)
error Command failed with exit code 1.

Downgrading ws to 3.3.2 does not fix the problem.

@davidnagli
Copy link
Contributor

@goyney This will be fixed once PR #320 lands

@JounQin
Copy link

JounQin commented Dec 17, 2017

@goyney Are you sure you've downgraded ws successfully? Check package-lock.json or yarn.lock to confirm that.

And I'm using resolutions of yarn to lock ws version, it really works to me.

https://github.com/JounQin/parcel-study/blob/master/package.json

@wangjian1119
Copy link

@JounQin hello,Can the downgrade ws to @3.3.2 solve the problem?

@JounQin
Copy link

JounQin commented Dec 18, 2017

@wangjian1119 I solve this problem by locking ws@3.3.2 for now with yarn resolutions

https://github.com/JounQin/parcel-study/blob/master/package.json#L70

You can just try it.

@DeeJayElly
Copy link

Guys this resolved the problem

Just run:

npm i -D -E ws@3.3.2

ionic-team/ionic-cli#2921 (comment)

@carrillocarlosce
Copy link

@DeeJayElly your solution work for me thanks;

@DeMoorJasper
Copy link
Member

DeMoorJasper commented Dec 18, 2017

Not using chrome or disabling hmr should also work, as far as l’ve read other issues related to this one

@lyyh
Copy link

lyyh commented Dec 18, 2017

@DeeJayElly thanks!This is a good way of resolution

@angganegara
Copy link

angganegara commented Dec 18, 2017

hmmm @DeeJayElly solution is not working for me. Parcel still crashed when I manually reload the page. I'm using the latest Chrome and ws@3.3.2. It's working fine in Safari though.

EDIT: it seems HMR is working normally and doesn't trigger the crash so everything is okay as long as I don't reload the page manually.

devongovett pushed a commit that referenced this issue Dec 18, 2017
* run prettier

* add proper error handling to sending data

* replace hacky bugfix with gracefull connection closing on client side

* improve error handling to catch all errors not just when sending

* fix tests

* code cleanup
@devongovett
Copy link
Member

Fix pushed in v1.2.1.

@angganegara
Copy link

@devongovett I can confirm this push fixes the issue for me. Cheers

@a313008430
Copy link

`wss.on('connection', function (ws) {
ws.on('error', function (msg) { //must
console.log(msg)
})
ws.on('close', function (msg) { //must
console.log(msg)
})

})`

@darwinphi
Copy link

Try to install parcel locally

devongovett pushed a commit that referenced this issue Oct 15, 2018
* run prettier

* add proper error handling to sending data

* replace hacky bugfix with gracefull connection closing on client side

* improve error handling to catch all errors not just when sending

* fix tests

* code cleanup
devongovett pushed a commit that referenced this issue Oct 15, 2018
* run prettier

* add proper error handling to sending data

* replace hacky bugfix with gracefull connection closing on client side

* improve error handling to catch all errors not just when sending

* fix tests

* code cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests