Skip to content

Python script fails to run on PM2 6.0.6 (works fine in 5.4.2) #5990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Fletacode opened this issue May 22, 2025 · 0 comments
Open

Python script fails to run on PM2 6.0.6 (works fine in 5.4.2) #5990

Fletacode opened this issue May 22, 2025 · 0 comments

Comments

@Fletacode
Copy link

Fletacode commented May 22, 2025

Describe the bug

When trying to run a Python script using PM2 6.x with the --interpreter option, the process immediately fails with a SyntaxError from PM2 internals, specifically referencing ProcessContainerForkBun.js.
This same script runs perfectly fine on PM2 version 5.4.2.

To Reproduce

Steps to reproduce the behavior:

This works on PM2 5.4.2

pm2 start main.py --name kookmin-feed --interpreter /path/to/venv/bin/python3

This fails on PM2 6.0.6

pm2 start main.py --name kookmin-feed --interpreter /path/to/venv/bin/python3

Expected behavior

The script should start normally in fork_mode as it does in PM2 5.x. PM2 is expected to launch the Python process using the specified interpreter without attempting to parse it as JavaScript.

Logs

SyntaxError: unterminated string literal (detected at line 29)
File "/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkBun.js", line 29

PM2 Version
• ✅ Works: 5.4.2
• ❌ Fails: 6.0.6

System Information
• OS: Ubuntu 22.04
• Node.js: 18.x
• Python: 3.12
• PM2 Mode: fork
• Command: pm2 start main.py --interpreter /path/to/python3

Additional context

It seems PM2 6.0.6 is attempting to launch the script through Bun, which incorrectly tries to parse the .py file as JavaScript, resulting in syntax errors.
This regression appears to be introduced due to Bun integration, and it affects all non-JS runtime scripts that rely on --interpreter.

Suggested resolution

Please ensure .py and other external scripts are handled using traditional child_process.spawn behavior as in PM2 5.x, and avoid applying Bun execution paths to non-JavaScript files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant