title: In Node.js, how can a module get data from an application's package.json?
body: <p>I have a module. Inside it, I'd like to access data from my parent application's package.json file. What's the best practice way to do that?</p>
  
  <p>I've done this the janky way by going up 2 levels and requiring the file (or using the <a href="https://github.com/flatiron/nconf" rel="noreferrer">nconf</a> configuration loader).</p>
  
  <pre><code>var appdir = path.resolve(__dirname, '../../');
  nconf.file('app', path.join(appdir, 'package.json'));
  </code></pre>
  
  <p>But that seems like it could break easily.</p>
  
  <p>Also I heard about <a href="https://github.com/indexzero/node-pkginfo" rel="noreferrer">pkginfo</a>, it will automatically grab info from my own module's package.json, but I'm looking to get data from the parent application's.</p>
  
  <p>Thanks for any help!</p>
  
  <p>EDIT: I suppose another way of asking is, how can I get the application's path (instead of the module path) ?</p>