title: How to start a package.json script in pm2
body: <p>I want to demonise my express js graphql api server. In windows local dev, I can start my server by running this command and it works fine:</p>
  
  <p><code>yarn dev</code></p>
  
  <p>This start command is defined in my <code>package.json</code> like this:</p>
  
  <pre><code>  "scripts": {
      "dev": "cross-env NODE_ENV=development DEBUG=express:* nodemon --exec babel-node src/index.js"
    },
  </code></pre>
  
  <p>When I try to start this in pm2 in my linux server, I get a success like this:</p>
  
  <pre><code>latheesan@app:~/apps/tweet/server$ pm2 start yarn -- dev
  [PM2] Starting /usr/bin/yarn in fork_mode (1 instance)
  [PM2] Done.
  </code></pre>
  
  <p>However, when I type <code>pm2 status</code> it says error and also the display looks really odd:</p>
  
  <p><a href="https://i.stack.imgur.com/x42Rm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x42Rm.png" alt="enter image description here"></a></p>
  
  <p>I am running this on <code>Ubuntu 16.04</code>.</p>
  
  <p>If I don't use the <code>pm2</code> and just start the app in my ubuntu server with <code>yarn dev</code> - it runs fine.</p>
  
  <p>Any ideas?</p>