1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Cypress cannot access Angular server, even though it is started on localhost

Discussão em 'Angular' iniciado por Brentspine, Agosto 28, 2025.

  1. Brentspine

    Brentspine Guest

    I have an Angular application, that I start locally via ng serve --proxy-config proxy.config.json and a Cypress set-up that has a baseUrl of http://localhost:4200. After starting the server I can access it via localhost:4200, but not 127.0.0.1:42000 or 0.0.0.0:4200.

    The problem is that when I try to start an e2e test in Cypress (no matter which browser selected) I get a CypressError:

    `cy.visit()` failed trying to load:

    http://localhost:4200/

    We attempted to make an http request to this URL but the request failed without a response.

    We received this error at the network level:

    > Error: connect ECONNREFUSED 127.0.0.1:4200

    Common situations why this would fail:
    - you don't have internet access
    - you forgot to run / boot your web server
    - your web server isn't accessible
    - you have weird network configuration settings on your computer


    Server is indeed running

    Why can Cypress not access the application? What can I do, so it can access it?

    (Posted as Q&A)

    Continue reading...

Compartilhe esta Página