Parcel: web socket error

Created on 20 Jan 2018  路  19Comments  路  Source: parcel-bundler/parcel

I am getting this strange error in the console inspecting the page brought me to the .js file in the dist folder highlighting this line.
it's line 31
var ws = new WebSocket('ws://' + window.location.hostname + ':50013/');

i haven't went in to that file or changed anything in it.

any help would be great I am running a windows pc and haven't had any issues with parcel before.

Bug

Most helpful comment

If anyone comes across this as I did, use --no-hmr flag as a workaround. I think it's a bug where HMR should be disabled by default for watch.

All 19 comments

@MatthewSmithwebdesign how did you fix it?

i didn't no one responded so i started over without parcel. i closed it because i guess it wasn't a big issue.

Could u give us the specific error that the console throws? Than we might be able to help
@MatthewSmithwebdesign

WebSocket connection to 'ws://localhost:58197/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
require.8 @ ........\AppData\Roaming\npm\node_modules\parcel-bundler\src\builtins\bundle-url.js:11

Ow damn that's def weird, u on the latest version of parcel?

how do u check the version?

Normally parcel -V should work

Sent with GitHawk

1.5.0

@MatthewSmithwebdesign do you use any anti-virus or firewall? Parcel use random ports, on Windows this can be blocked by firewalls and anti-viruses.

Also you could help us by running this command and giving us the output of netstat -a -b in the Command Prompt while Parcel is running.
This will show uses what port are used and if they are blocked. Thanks

The requested operation requires elevation.

You might need to start the Command Prompt as Administrator for this one

In my case I just had to delete the .cache and dist folder and everything started working again.

Hi, There is a way to setup this WS port? I am working with Docker and I have to expose the port to the host machine.

@jmanuelcorral yes, using 鈥攈mr-port

Sent with GitHawk

Hi, I know this might be a little off (I' ve came here from Google search). I am working on VS 2017 with an mvc project and running parcel with vue. Recently I add my site to Local IIS 8 and this web socket error appeared. Even though I saw that many ppl have this issue with docker, is there any solution for IIS?
Edit: In my hosts file i bind the 127.0.0.1 to a custom-local domain!
Thanks in advance!

@Ponokefalos Same here, have you found a solution yet?

@thiagomajesk Nop! Nobody answered so I gave up the approach with IIS 8. Instead I am using IIS Express when i want to work with Vue and Local IIS when working with the rest of the project (Mvc/Razor screens). Sorry mate, I would really want to help you! If btw you find something please submit the solution here in case someone else comes from Google search with the same issue.

I've been getting this error too on this code https://glitch.com/~parcel-js

I'm using parcel watch index.html so it doesn't spin up a web server and so I'm serving the files with Express, so I guess that's why.... Is there any way to stop it from requiring websockets? when using "parcel watch"?

Does it do the same in production build?

If anyone comes across this as I did, use --no-hmr flag as a workaround. I think it's a bug where HMR should be disabled by default for watch.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidnagli picture davidnagli  路  3Comments

medhatdawoud picture medhatdawoud  路  3Comments

donaldallen picture donaldallen  路  3Comments

466023746 picture 466023746  路  3Comments

philipodev picture philipodev  路  3Comments