#how to run astro app on port 2022
3 messages · Page 1 of 1 (latest)
Hi @bold knot. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
You can run your Astro project on a specific port by using the --port flag when starting the development server. In your case, to run the Astro app on port 2022, you can use the following command:
npx astro dev --port 2022
Alternatively, you can specify the port in your package.json file. Add --port 2022 to the dev and start scripts:
{
"scripts": {
"dev": "astro dev --port 2022",
"start": "astro dev --port 2022",
}
}
You can also specify the port in your astro.config.mjs file:
import { defineConfig } from 'astro/config';
export default defineConfig({
server: { port: 2022 }
})
Please note that you need to replace 2022 with your desired port number.
Sources:
- Github Issue (closed): please change the deafult PORT to :3000 > Comments (https://github.com/withastro/astro/issues/8284)