Brain easy, by default follow your node js version in PM2. example in mine like below
then , running your nextjs application with node js version same as PM2.
$ sudo /www/server/nodejs/v18.13.0/bin/npm install
$ sudo /www/server/nodejs/v18.13.0/bin/npm build
inside your nextjs project then running your PM2 with this command,
$ sudo /www/server/nodejs/v18.13.0/bin/pm2 start 'npm run start:prod' --name YOUR_PROJECT_NAME --cron-restart="0 */6 * * *" -- start --node-args="--max-old-space-size=4096" --max-memory-restart 4G
$ sudo /www/server/nodejs/v18.13.0/bin/pm2 save --force
if you're success, project has running with pm2 in pm2 manager apps.
PS:
You can change your node js version, in mine it's v18.13.0, if your config change to v20.13.1
Make sure your NEXT Js version support for node js v20.13.1.
have a nice day.