#I can't access to the astro page from browser

3 messages · Page 1 of 1 (latest)

minor trellis
#

I created a new astro app and started on port 4321
But I can't open localhost:4321 from browser
what's the reason and how to fix it?

mental frostBOT
#

Hi @minor trellis. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

There could be several reasons why you're unable to access your Astro project on localhost:4321 from your browser. Here are a few troubleshooting steps you can take:

  1. Check if the Astro server is running: While the Astro server is running in dev mode, you should see a localhost link in your terminal window. If you don't see this, it's possible that the server isn't running. You can start the server by typing npm run dev, pnpm run dev, or yarn run dev in the terminal, depending on your package manager. source (https://docs.astro.build/en/install/auto#2-start-astro-)

  2. Check for errors in the terminal: If you aren't able to open your project in the browser, go back to the terminal where you ran the dev command and look to see if an error occurred, or if your project is being served at a different URL than the one linked to above. source (https://docs.astro.build/en/install/auto#2-start-astro-)

  3. Check your Astro and Node versions: There was a reported issue where the page never stopped loading when trying to access localhost:4321 in the browser. The user was using Astro v4.1.3 and Node v20.10.0. If you're using similar versions, this could be a potential cause. source (https://github.com/withastro/astro/issues/9710)

  4. Debug your code: You can use console.log() to debug your Astro code. If the statement is in Astro frontmatter, it will output to the terminal running the Astro CLI. If the code is written or imported inside of an Astro <script> tag, it will be printed to the console in your browser. source (https://docs.astro.build/en/guides/troubleshooting#_top)