我正在使用 NX 工作区。在我的项目中有一个 Nest Js 应用程序。我曾经在AWS EC2中部署这个应用程序。我在那里安装了PM2。
// pm2.config.js
module.exports = {
apps: [
{
name: 'Backend API',
script: 'npm',
args: 'start',
cwd: 'apps/api/src',
interpreter: 'ts-node',
env: {
PORT: 3000,
NODE_ENV: 'production',
},
},
],
};
该条位于我的根目录中,我运行 pm2 start pm2.config.js
不工作。有什么解决办法吗
// pm2.config.js
module.exports = {
apps: [
{
name: 'Backend API',
script: 'npx',
args: 'nx run api:serve',
cwd: 'apps/api',
interpreter: 'ts-node',
env: {
PORT: 3000,
NODE_ENV: 'production',
},
},
],
};
我只是把这个脚本改成这样。工作了