1

So I've been having some problems with PM2 and node-config. Whenever I run my app with PM2, I get the error; FATAL: NODE_APP_INSTANCE value of '0' did not match any instance config file names.

I've tried all the documented ways of "fixing" this such as making a default-0.json/js file, setting the instance_var variable in my pm2 config, and I even tried setting an actual system environment variable, but nothing is working.

I was wondering if anyone had any ideas on how I could fix this?

1 Answers1

3

You may have problems with node-config with the NODE_APP_INSTANCE name, so you can rename it with instance_var options :

module.exports = {
  apps : [
      {
        name: "myapp",
        script: "./app.js",
        watch: true,
        instance_var: 'INSTANCE_ID',
        env: {
            "PORT": 3000,
            "NODE_ENV": "development"
        }
      }
  ]
}
Unitech
  • 5,781
  • 5
  • 40
  • 47
  • Hey there, so for instance_var in my case for the error I’m getting, would I set it to 0? Because I tried this instance_var setting before and it didn’t work. –  Dec 27 '18 at 01:02
  • Yes you have to set 'instance_var' : 0 – jazeb007 Oct 14 '19 at 08:08