title: Why is PM2 not launching my Node process?
body: <p>Previously I have had success implementing PM2, but not currently.  </p>
  
  <p>My node app <em>does</em> run just fine if I start it manually, but nothing I do gets it to run via PM2, even though PM2 <em>appears</em> to be starting it up.  Here's what I mean:</p>
  
  <p>If I run pm2 start server/index.js, the response in the terminal reads:</p>
  
  <pre><code>$ pm2 start server/index.js
  [PM2] Spawning PM2 daemon with pm2_home=c:\pm2_system\.pm2
  [PM2] PM2 Successfully daemonized
  [PM2] Starting D:\Program Files\nodeApps\service-management-api\server\index.js in fork_mode (1 instance)
  [PM2] Done.* 
  </code></pre>
  
  <p>Then the terminal prints out a table with App info.  It doesn't look pretty pasted here so I'll list it out:</p>
  
  <pre><code>App Name: index
  id: 0
  version: 1.0.0
  mode: fork
  pid: 8984
  status: online
  restart: 0
  update 0s
  cpu: 0% 
  mem: 26.0 MB
  user: ME
  watching: disabled
  </code></pre>
  
  <p>It appears that the node process should be running.  But if I immediately enter <em>pm2 list</em> it shows no processes running.  If I enter pm2 stop index, it says:</p>
  
  <pre><code>$ pm2 stop index
  [PM2] Spawning PM2 daemon with pm2_home=c:\pm2_system\.pm2
  [PM2] PM2 Successfully daemonized
  [PM2][ERROR] Process index not found
  </code></pre>
  
  <p>Alternatively, if I try using ecosystem.config.js in the commands, I get similar results.  Here are the commands tried:</p>
  
  <pre><code>pm2 reload ecosystem.config.js
  pm2 start ecosystem.config.js
  </code></pre>
  
  <p>Example result of running those commmands:</p>
  
  <pre><code>$ pm2 start ecosystem.config.js
  [PM2] Spawning PM2 daemon with pm2_home=c:\pm2_system\.pm2
  [PM2] PM2 Successfully daemonized
  [PM2][WARN] Applications sm_api not running, starting...
  [PM2] App [sm_api] launched (2 instances)
  </code></pre>
  
  <p>And CLI prints table showing two instances with status "online" and watching "enabled".  And yet, app isn't running (when tested from browser) and "pm2 show " returns:</p>
  
  <pre><code>[PM2] Spawning PM2 daemon with pm2_home=c:\pm2_system\.pm2
  [PM2] PM2 Successfully daemonized
  [PM2][WARN] &lt;app name&gt; doesn't exist
  </code></pre>
  
  <p>Any clues what's gone awry with my pm2?  </p>
  
  <p>Heres my ecosystem.config.js file:</p>
  
  <pre><code>module.exports = {
    apps : [{
      name: 'sm_api',
      script: 'server/index.js',
      "log_date_format"  : "YYYY-MM-DD HH:mm Z",
  
      // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
      args: 'one two',
      instances: 'max',
      error_file : "C:\\pm2_system\\.pm2\\logs\\sm-api-error",
      out_file: "C:\\pm2_system\\.pm2\\logs\\sm-api-out",
      autorestart: true,
      watch: "../",
      max_restarts: 10,
      max_memory_restart: '1G',
      env: {
        NODE_ENV: 'development'
      },
      env_production: {
        NODE_ENV: 'production'
      },
      exec_mode: 'cluster'
    }],
  };
  </code></pre>
  
  <p>Running in Windows Server 2012 environment.  Note that I intend to add pm2-windows-service package after I get pm2 working.  </p>