How Can I run PM2 with Angular-Cli? - Angular2

前端 未结 7 770
夕颜
夕颜 2020-12-30 07:33

How can I run: ng serve --prod with pm2?

ng serve from angular-cli, Angular2. I\'m running on DigitalOcean.

I have tried to test with ht

相关标签:
7条回答
  • 2020-12-30 08:00

    With PM2 recent version

    pm2 ecosystem
    

    than update

    ecosystem.config.js as follows

    module.exports = {
      apps : [{
        name: 'demoapp',
        script: 'node_modules/@angular/cli/bin/ng',
        args: 'serve --host [yourip] --disable-host-check',
        instances: 1,
        autorestart: true,
        watch: false,
        max_memory_restart: '1G',
        env: {
          NODE_ENV: 'development'
        },
        env_production: {
          NODE_ENV: 'production'
        }
      }],
    
      deploy : {
      }
    };
    

    finally

    pm2 start & pm2 save

    0 讨论(0)
提交回复
热议问题