title: npm postinstall script and npm link
body: <p>I have written a module that has a post-install script to perform some tasks. </p>
  
  <p>However, during the development phase of the module, I am using the "npm link" (from within the module directory) and "npm link myModule" (from within the application directory</p>
  
  <p>this has lead to an issue though: the postinstall script needs to read some file from the application directory. </p>
  
  <p>As the module is npm linked, and there is a link in the node_modules directory to the module source folder, the node process that kicks off the post install script has a working directory of the module, not the application.</p>
  
  <p>As a result, the application directory is unknown </p>
  
  <p>Is there a workaround for this ?</p>
  
  <p><strong>--------update--------</strong></p>
  
  <p>if I modify <em>npm/lib/utils/lifecycle.js</em> (<a href="https://github.com/npm/npm/blob/2.x/lib/utils/lifecycle.js" rel="nofollow">https://github.com/npm/npm/blob/2.x/lib/utils/lifecycle.js</a>)  and insert this at line 55</p>
  
  <pre><code> env.npm_start_dir = process.cwd();
  </code></pre>
  
  <p>then I can access the original directory where the user typed "npm link" by accessing </p>
  
  <pre><code>process.env.npm_start_dir
  </code></pre>
  
  <p>I would much rather have an "official" way of doing this though</p>