The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Pm2: Make your Nuxt 3 live app run on a port other than 3000

posted on 4.2.2023 by Below Surface in "Nuxt"

After following the official documentation and other related posts that did not work for me, I finally found the solution on Stack Overflow! The issue persisted when trying to run the Nuxt 3 app on my Nginx instance. Pm2 would always pick port 3000, which was already in use. I needed to switch it to 3002 and finally, this is the solution:

$ npm run build
$ PORT=3002 pm2 start npm -- start

May it help someone else and save some time.

Tags:

pm2
nuxt
nginx
port

Sources:

https://stackoverflow.com/questions/31502351/how-to-specify-a-port-number-for-pm2

More posts of this category

My Nuxt 3 fix for npm ERR! Invalid comparator: latest

After starting to code with Nuxt, I ran into this issue and found the fix

Nuxt

Use environmental variables in Nuxt 3

Learn about .env, runtimeConfig and the setup() method

Nuxt

How to add HTML head data to a Nuxt 3 app

Learn how to set the important SEO data

Nuxt