title: How to start next.js app with pm2 in cluster mode using Yarn?
body: <p>Iam trying to start a next.js app with 2 clusters in pm2. So mapped the command <code>yarn start</code> to <code>pm2 start yarn -i 2 --name "frontend" -- start</code> </p>
  
  <p>App starts and then crashes within a second.</p>
  
  <pre><code>[PM2] Starting /usr/bin/yarn in cluster_mode (2 instances)
  [PM2] Done.
  ┌─────┬─────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
  │ id  │ name        │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
  ├─────┼─────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
  │ 0   │ frontend    │ default     │ N/A     │ cluster │ 14901    │ 0s     │ 0    │ online    │ 0%       │ 33.8mb   │ user  │ disabled │
  │ 1   │ frontend    │ default     │ N/A     │ cluster │ 14908    │ 0s     │ 0    │ online    │ 0%       │ 28.8mb   │ user  │ disabled │
  └─────┴─────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
  </code></pre>
  
  <p>Output of .log file</p>
  
  <pre><code>0|frontend | /usr/share/yarn/bin/yarn:2
  0|frontend | argv0=$(echo "$0" | sed -e 's,\\,/,g')
  0|frontend |         ^^^^
  0|frontend | 
  0|frontend | SyntaxError: missing ) after argument list
  0|frontend |     at Module._compile (internal/modules/cjs/loader.js:895:18)
  0|frontend |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
  0|frontend |     at Module.load (internal/modules/cjs/loader.js:815:32)
  0|frontend |     at Function.Module._load (internal/modules/cjs/loader.js:727:14)
  0|frontend |     at /usr/local/lib/node_modules/pm2/lib/ProcessContainer.js:301:25
  0|frontend |     at wrapper (/usr/local/lib/node_modules/pm2/node_modules/async/internal/once.js:12:16)
  0|frontend |     at next (/usr/local/lib/node_modules/pm2/node_modules/async/waterfall.js:96:20)
  0|frontend |     at /usr/local/lib/node_modules/pm2/node_modules/async/internal/onlyOnce.js:12:16
  0|frontend |     at WriteStream.&lt;anonymous&gt; (/usr/local/lib/node_modules/pm2/lib/Utility.js:186:13)
  0|frontend |     at WriteStream.emit (events.js:210:5)
  </code></pre>
  
  <p>Note: Starting the app as an npm application works, but in fork mode. </p>