Starting the app with PM2 on Windows logs error at NPM.CMD with Unexpected Token

System Information
  • Strapi Version: 3.5.4
  • Operating System: Windows 10
  • Database: MongoDB
  • Node Version: 14.16.1
  • NPM Version: 6.14.4

I am trying to run the StrApi admin template on a Windows machine under pm2. I could start the ecosystem.config.js using pm2 start ecosystem.config.js but the admin site doesn’t load on a browser. Checking the pm2 logs shows error at C:\PROGRAM FILES\NODEJS\NPM.CMD with SyntaxError: Unexpected token ‘:’ .

My package.json is something like this.

{
  "name": "online-booking-str-api",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "production": "cross-env NODE_ENV=production npm run build",
    "start-production": "cross-env NODE_ENV=production npm start"
  },
  "devDependencies": {},
  "dependencies": {
    "cross-env": "^7.0.3",
    "strapi": "3.5.4",
    "strapi-admin": "3.5.4",
    "strapi-connector-mongoose": "3.5.4",
    "strapi-plugin-content-manager": "3.5.4",
    "strapi-plugin-content-type-builder": "3.5.4",
    "strapi-plugin-email": "3.5.4",
    "strapi-plugin-upload": "3.5.4",
    "strapi-plugin-users-permissions": "3.5.4",
    "strapi-utils": "3.5.4"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "<the alphanumeric uuid>"
  },
  "engines": {
    "node": ">=10.16.0 <=14.x.x",
    "npm": "^6.0.0"
  },
  "license": "MIT"
}

And ecosystem.config.js is as following

module.exports = {
  apps: [
    {
      name: 'online-booking-str-api',
      script: 'npm',
      args: 'start-production', //'start'
      env: {
        NODE_ENV: 'production',
      },
      exp_backoff_restart_delay: 100,
    },
  ],
};

I am sorry if I’m missing anything in the configuration or installation. Any workaround or solution for this will be really helpful.

Thanks.

Hi @sranjan-m,

Did you ever manage to resolve this issue? I’m experiencing the same issue :confused:

Thanks.