I've been following the official docs for deploying a Strapi app onto Digital ocean, but I'm having trouble setting up pm2. It starts the app for a second, and then shows
status: errored
there's no script.js to run the app, but when I cd to /home/myusername/appname/backend and run npm start, it works just fine, which leads me to believe that I have the ENV variables set correctly
Here's the config file
module.exports = {
apps: [
{
name: 'strapi',
cwd: '/home/your-name/project/backend',
script: 'npm',
args: 'start',
env: {
NODE_ENV: 'production',
DATABASE_HOST: 'localhost', // database endpoint
DATABASE_PORT: '5432',
DATABASE_NAME: 'strapi', // DB name
DATABASE_USERNAME: 'your-name', // your username for psql
DATABASE_PASSWORD: 'password', // your password for psql
},
},
],
};
Then I run pm2 logs, I see
2020-07-13T01:58:49: PM2 log: App [strapi:0] online
PM2 | 2020-07-13T01:58:49: PM2 error: Error: spawn node ENOENT
PM2 | at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
PM2 | at onErrorNT (internal/child_process.js:415:16)
PM2 | at process._tickCallback (internal/process/next_tick.js:63:19)
Thanks