Cypress test not starting and throwing handshake error in console

Viewed 2124

I am trying to follow the getting started guide at https://docs.cypress.io/guides/getting-started/installing-cypress.html#System-requirements and when I run the following command

npx cypress open

it opens a popup and lists all the example specs. For now I am just running the example specs but this where I am facing the issue. It opens a browser but the page is just blank and I see the following error in the console,

Websocket connection to 'ws://localhost:62083/__socket.io/?EIO=3&transport=websocket' failed: Connection closed before receiving a handshake response

I tested the same app in another machine and it works but its not working on my machine. Is there something that is causing the issue. My laptop is an office laptop is behind proxy. I checked the cypress proxy setting and I see that the proxy is correctly configured.

1 Answers

I had the same issue on my mac and this comment from filiphric solved the problem: https://github.com/cypress-io/cypress/issues/1239#issuecomment-419657694

  1. open terminal, type: sudo nano /etc/hosts
  2. if nothing is present, input defaults:
##
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
  1. save and close. (ctrl + X then y then enter)
  2. reopen cypress and all should work normally

Hope it can help you too!

Related