Skip to content

Create duplicate services when using PM2 with next.js #5197

@jim-king-2000

Description

@jim-king-2000

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions