79203422

Date: 2024-11-19 12:32:38
Score: 0.5
Natty:
Report link

So in my situation in case anyone ever comes across this. For purposes of security, I created a seperate user to purely run my nextjs application. Additionally I sought such a third party application out to run it in the background since when i would run

npm run dev nohup&

this would ultimately fail due to the background services unable to "access" the application files due to ownership being given to the created account. I say this because this ultimately would made pm2 produce failed commands and unable to actually start the nextjs server. Long story short I ended up updating permissions on the folder itself and was able to get this working with

pm2 start "npm run dev" --name "nextjs server"

and whenever I need to check logs i do

pm2 logs "nexjs server"

if i update files sometimes it automatically propagates when i use git but sometimes it does not so you can do

pm2 restart "nextjs server"

or

pm2 stop "nextjs server"

pm2 start "nextjs server"

Dont forget! sometimes you need to do maintenance and restart server. run pm2 save and it will save the processes you are running cause I imagine your running some kind of backend as well.

I know this was probably more then you needed but the other commands did not work to get my nextjs going and if your running into same issues maybe this will help you!

Reasons:
  • Blacklisted phrase (0.5): I need
  • Blacklisted phrase (1): did not work
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kid Yume