Hi I want to change the default port 3000 to 3001
according to nuxt doc we just need to add the port to .env file https://nuxt.com/docs/getting-started/deployment#configuring-defaults-at-runtime
I put those to my env but not working
#NITRO_PORT = "3001"
PORT = "3001"
how I build the nuxt 3
first I go to nuxt project directory
run npm run build
them pm2 start
after I check
netstat -plant | grep 3001
does not return anything
but netstat -plant | grep 3000
did has return
0
0
:::3000
:::*
LISTEN
711987/PM2 v5.2.2:
btw this is my ecosystem.config.js
module.exports = {
apps: [
{
name: 'nuxt-php-framework',
exec_mode: 'cluster',
instances: 'max',
script: './.output/server/index.mjs'
}
]
}
this is my package .json
{
"name": "nuxt-php-framework",
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"axios": "^1.2.1",
"nuxt": "^3.0.0"
},
"devDependencies": {
"@nuxt/postcss8": "^1.1.3",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.20",
"tailwindcss": "^3.2.4"
}
}
thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi @stupidboy,
Add the port in the module.export section and then start your application. Something like the following should do the trick