node.jsnestjspm2node-mssql

Unable to run node application using pm2


I made a small nestjs webapp, it connects to a local mssql database and works fine... Except if I try to launch it using pm2.

But if I try to launch my app running pm2 start build/main.js I get DB connection errors: TypeError: The "config.server" property is required and must be of type string.

My DB connection parameters are currently stored in a .env file. I load them running env.config() and it's working fine for the other three running methods I listed. I've tried to change the parameters to include quotes and double quotes, with no luck:

What am I doing wrong?


Solution

  • We just found out that changing the syntax from pm2 start to something like pm2 start npm --name "myApp" -- run start:prod worked.