Replies: 5 comments 8 replies
-
You can use Capistrano-like deploy with PM2 https://pm2.keymetrics.io/docs/tutorials/capistrano-like-deployments |
Beta Was this translation helpful? Give feedback.
-
i solve this by create a script https://gist.github.com/Kamleshpaul/d22887c48e0c0d231734da24e8a80660 here to update my server i run this |
Beta Was this translation helpful? Give feedback.
-
@Kamleshpaul In which directory do you run the script. The root path of the Next.js project? |
Beta Was this translation helpful? Give feedback.
-
Hi @Kamleshpaul, BUILD_DIR=temp is not working on my side. It doesn't create the temp dir; the output is still in .next. Do you have any special setup in package.json or any config files? Thank you. |
Beta Was this translation helpful? Give feedback.
-
Hi, It's 2025, is there a better solution for this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm deploying my Next.js app in a Ubuntu Server machine using PM2 (
pm2 start ...
), but every time I runnext build
, I get Internal Server Error, I imagine that's because the app cannot be running at the same time it's building.I'd like some suggestions on how to build and restart the app without downtime. PM2 has cluster mode but it also fails when I run
next build
with the app running.next export
to a directory, and build the app in another directory before replacing it?I'm aware that Vercel has built-in support for 0-second-downtime, just wondering how I'd do that in Ubuntu directly.
Beta Was this translation helpful? Give feedback.
All reactions