How use pm2 start nestjs Application ?

See original GitHub issue
$ pm2  logs

6|okoer-ap | 2018-04-13 17:04: [Nest] 19985   - 2018-04-13 17:04: 2018-4-13 17:04:37   2018-04-13 17:04: [RouterExplorer] 2018-04-13 17:04: Mapped {/:sku_id/suit/minus, PUT} route2018-04-13 17:04:  +0ms2018-04-13 17:04:
6|okoer-ap | 2018-04-13 17:04: [Nest] 19985   - 2018-04-13 17:04: 2018-4-13 17:04:37   2018-04-13 17:04: [RouterExplorer] 2018-04-13 17:04: Mapped {/:sku_id/changelog, GET} route2018-04-13 17:04:  +1ms2018-04-13 17:04:
6|okoer-ap | 2018-04-13 17:04: [Nest] 19985   - 2018-04-13 17:04: 2018-4-13 17:04:37   2018-04-13 17:04: [NestApplication] 2018-04-13 17:04: Nest application successfully started2018-04-13 17:04:  +1ms2018-04-13 17:04:

The log is very messy, The log time has appeared many times

Use nodemon to start the service, the log is normal

$  nodemon

[Nest] 21194   - 2018-4-13 17:13:03   [RouterExplorer] Mapped {/:sku_id/single/minus, PUT} route +0ms
[Nest] 21194   - 2018-4-13 17:13:03   [RouterExplorer] Mapped {/:sku_id/suit/plus, PUT} route +1ms
[Nest] 21194   - 2018-4-13 17:13:03   [RouterExplorer] Mapped {/:sku_id/suit/minus, PUT} route +0ms
[Nest] 21194   - 2018-4-13 17:13:03   [RouterExplorer] Mapped {/:sku_id/changelog, GET} route +0ms
[Nest] 21194   - 2018-4-13 17:13:03   [NestApplication] Nest application successfully started +1ms

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
brizercommented, May 14, 2019

use a ecosystem.config.js file, like this:

module.exports = {
  apps : [{
    name: 'serve-data-prod',
    script: 'dist/main.js',

    // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
    args: 'one two',
    instances: 1,
    autorestart: true,
    watch: false,
    max_memory_restart: '1G',
    env: {
      NODE_ENV: 'production'
    }
  }],

  deploy : {
    production : {
      user : 'node',
      host : '212.83.163.1',
      ref  : 'origin/master',
      repo : 'git@github.com:repo.git',
      path : '/var/www/production',
      'post-deploy' : 'npm install && pm2 reload ecosystem.config.js --env production'
    }
  }
};
1reaction
marpstarcommented, Apr 15, 2018

@tomoat how are you launching. I’m using ts-node to launch via a package.json script e.g.

"start": "ts-node --type-check index.js"

I launch using pm2 via pm2 start npm -- start without issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploy Nest JS App using PM2 to Linux Server - Daniel Santoso
STEP 1 (Install Node JS) · STEP 2 (Install Nest JS CLI) · STEP 3 (Install PM2) · STEP 4 (Clone your project...
Read more >
Deploy Nest JS App using PM2 on Linux (Ubuntu) Server
Step 1 (Install Nest JS CLI) · Step 2 (Install PM2) · Step 3 (Clone Code Repository) · Step 4 (Build Project) ·...
Read more >
Deploy NestJS with PM2 - Stack Overflow
I'm trying to deploy my Angular + NestJS application on my Ubuntu server with PM2 and NGINX. I have build my server, that...
Read more >
How to run production NestJS app using pm2 - Reddit
Does anyone know how to run NestJS npm start:prod using pm2 ? What I am currently doing is pm2 start npm --name "api-name"...
Read more >
Manage Node.js App or Processes with PM2 ... - Shade
Manage Node.js App or Processes with PM2 (Process Manager 2) ; npm install pm2@latest -g. #OR ; # <app> being the filename you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found