In the projects not using next.js, we use "pm2 start pm2.json. It never generates duplicate pm2 instances.
When using PM2 with next.js, we can't use pm2.json configuration file. The code is like the following:
// package.json
"start": "node --experimental-modules server.mjs"
// deploy.sh
pm2 start npm --name "myproj" -- start
When I run deploy.sh without deleting the existing "myproj" pm2 instance, there would be two "myproj" instances. And it disables the auto-deployment script.
Looking forward to the answer.