module.exports = {
apps : [{
name : "my_app",
cwd : "/abosolute/path-to/my-app/",
script : "main.py",
cron_restart : "0 * * * *",
interpreter: "/absolute/path-to/venv/bin/python",
log_date_format: "DD-MM HH:mm:ss.SSS"
}]
}
I get the following error
0|my_app | 10-04 16:03:15.501: SyntaxError: unterminated string literal (detected at line 29)
0|my_app | 10-04 16:03:15.527: File "/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkBun.js", line 29
0|my_app | 10-04 16:03:15.527: // Change some values to make node think that the user's application
0|my_app | 10-04 16:03:15.528: ^
0|my_app | 10-04 16:03:15.528: SyntaxError: unterminated string literal (detected at line 29)
0|my_app | 10-04 16:03:15.557: File "/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkBun.js", line 29
0|my_app | 10-04 16:03:15.557: // Change some values to make node think that the user's application
I'm able to run the script using cmd
pm2 start main.py --interpreter=../venv/bin/python
Also works in following 2 cases
Node Version: v18.19.1 PM2 Version: 6.0.5 Python Version: 3.12.3
For anyone who is facing similar issue. That is
SyntaxError: unterminated string literal (detected at line 29)
File "/usr/local/lib/node_modules/pm2/lib/ProcessContainerForkBun.js", line 29
// Change some values to make node think that the user's application
The key point here is the commented line which is actually a message.
You have to try modifying the parameters in my case it was something like this
Set interpreter as "none" and script to "/absolute/path/venv/bin/python main.py"
It might be different parameter for you tho. (If anyone has more in detailed answer please feel free to edit my answer)