title: How to prevent PM2 to change the current directory?
body: <p>Im using <a href="https://github.com/Unitech/pm2" rel="nofollow">pm2</a> to handle my nodejs micro services and <a href="https://github.com/ericf/express-handlebars" rel="nofollow">express-handlebars</a> to handle the views:</p>
  
  <pre><code>var hbs = exphbs.create({
    defaultLayout: 'main',
    helpers: {
      ifeq: function(a, b, options) {
        if (a === b) {
          return options.fn(this);
        }
        return options.inverse(this);
      },
      toJSON : function(object) {
        return JSON.stringify(object);
      }
    }
  });
  
  app.engine('handlebars', hbs.engine);
  app.set('view engine', 'handlebars');
  </code></pre>
  
  <p>Lunching the app directly (node app.js) works great. But if I lunch it using PM2 (pm2 start app.js) i get:</p>
  
  <blockquote>
    <p>Error: Failed to lookup view "home" in views directory "/root/views"</p>
  </blockquote>
  
  <p>When lunching pm2 the current working directory change to /root/ and since my app in not there I got an error from handlebars trying to open the views directory (which is in the app directory).</p>
  
  <p>Is there a way to fix this by telling pm2 the current working directory or by telling the express-handlebars library the complete directory instead of using a relative one? </p>