Tried pm2 today in ec2 and got some error, any idea?
/home/ubuntu/.pm2/pm2.log last 15 lines:
PM2 | at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
PM2 | at onErrorNT (node:internal/child_process:478:16)
PM2 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
PM2 | 2022-08-19T15:24:27: PM2 log: App [strapi-cms:0] starting in -fork mode-
PM2 | 2022-08-19T15:24:27: PM2 log: App [strapi-cms:0] online
PM2 | 2022-08-19T15:24:27: PM2 error: Error: spawn node ENOENT
PM2 | at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
PM2 | at onErrorNT (node:internal/child_process:478:16)
PM2 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
PM2 | 2022-08-19T15:34:46: PM2 log: App [strapi-cms:0] starting in -fork mode-
PM2 | 2022-08-19T15:34:46: PM2 log: App [strapi-cms:0] online
PM2 | 2022-08-19T15:34:46: PM2 error: Error: spawn node ENOENT
PM2 | at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
PM2 | at onErrorNT (node:internal/child_process:478:16)
PM2 | at processTicksAndRejections (node:internal/process/task_queues:83:21)
here is my ecosystem.config.js,
module.exports = {
apps: [
{
name: ‘strapi-cms’,
cwd: ‘/home/ubuntu/strapi_cms’,
script: ‘npm’,
args: ‘start’,
env: {
NODE_ENV: ‘production’,
DATABASE_HOST: ‘something-exxxxxast-1.rds.amazonaws.com’,
DATABASE_PORT: ‘5432’,
DATABASE_NAME: ‘sdfadsfaf’,
DATABASE_USERNAME: ‘adfadfasd’,
DATABASE_PASSWORD: ‘adfasdfasfd’,
AWS_ACCESS_KEY_ID:‘yyyyyy’,
AWS_SECRET_ACCESS_KEY:‘xxxx’,
AWS_REGION:‘xx-xx-x’,
AWS_BUCKET_NAME:‘xxxx-xxx’
}
},
],
}
I tried different node version 16,17, 18, all the same.
With all these creds in .env, I can start it with nohup.