Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Nuxt 3 Port

I tried the old solution but it not works any more, then I tried to read the nuxt 3 documentation, and it is not actually update.

So how to change How to change Nuxt 3 Port without change dev script like @kissu did here

I tried the old solution

on /.nuxt.config.ts

export default defineNuxtConfig(
  
    server: {
      port: 8080,
    },
  
})

and I got http://localhost:3000

Edit:

I found the way using .env file

into your .env file ([project_root] /.env)

PORT=8080

Nuxt 3 detect it automaticaly from your env variable .

like image 844
Jesse Avatar asked Sep 14 '25 11:09

Jesse


1 Answers

In Nuxt3 nuxt.config.ts

export default defineNuxtConfig({
  devServer: {
    port: 8000
  }
})
like image 77
Michal S Avatar answered Sep 16 '25 02:09

Michal S