getting spawn node ENOENT in pm2
Asked Answered
E

1

7

I was trying to setup strapi on AWS

I was following the instructions listed on their site: https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html

Here is my folder structure

enter image description here

And this would be my ecoystem.config.js file

module.exports = {
  apps: [
    {
      name: 'my-project',
      cwd: '/home/ubuntu/Strapi',
      script: 'npm',
      args: 'start',
      env: {
        NODE_ENV: 'production',
        DATABASE_HOST: 'r123-strapi-database.ce7f.us-east-2.rds.amazonaws.com', // database Endpoint under 'Connectivity & Security' tab
        DATABASE_PORT: '5432',
        DATABASE_NAME: 'r123_Strapi_db', // DB name under 'Configuration' tab
        DATABASE_USERNAME: 'postgres', // default username
        DATABASE_PASSWORD: 'r123_strapi_pasW',
      },
    },
  ],
};

Is aws Master username equivalent to DATABASE_USERNAME in the above? because master username is r123_strapi_101

When I run pm2 start ecosystem.config.js i get this error

PM2        | 2020-09-07T20:04:11: PM2 error: Error: spawn node ENOENT
PM2        |     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
PM2        |     at onErrorNT (internal/child_process.js:469:16)
PM2        |     at processTicksAndRejections (internal/process/task_queues.js:84:21)

Can someone please help me in fixing this or what I could be doing wrong?

Erose answered 7/9, 2020 at 20:18 Comment(0)
M
1

I managed to fix it by reinstalling Node.js and renaming my app in my ecoystem.config.js file, from "strapi-test" to "strapi-test-app". For some reason, the first config never started.

Console output pm2 list:

Console output pm2 list

Mate answered 9/8, 2022 at 14:47 Comment(1)
This is the solution. There's an arbitrary length limit in PM2, but it's not documented. I also fixed this error by changing the "name" property in ecosystem.config.js to a short, single-word name.Eggers

© 2022 - 2024 — McMap. All rights reserved.