title: Where should my npm modules be installed on Mac OS X?
body: <p>I was attempting to upgrade <code>phonegap</code> via <code>npm</code> when I started running into trouble. Long story short, there are two <code>node_modules</code> directories on my computer.</p>
  
  <pre><code>/usr/local/lib/node_modules
  /usr/local/share/npm/lib/node_modules
  </code></pre>
  
  <p>When I run <code>npm upgrade -g phonegap</code>, it appears that <code>npm</code> updates the copy of the package that resides in <code>/usr/local/lib/node_modules</code>. However, if I <code>which phonegap</code> I find that the symlink points to the older installation at <code>/usr/local/share/npm/lib/node_modules</code>.</p>
  
  <p>Also, when I attempt to install a stand alone package such as <code>express</code>, the files are installed in the <code>/usr/local/lib/node_modules</code> directory, <strike>but no symlink to the executable is created in anywhere in my <code>$PATH</code>.</strike></p>
  
  <p>Two questions:</p>
  
  <ul>
  <li>Which is the proper directory for node modules on Mac OS X?</li>
  <li><strike>How can I configure <code>npm</code> to link executables in my <code>$PATH</code> when it installs software?</strike></li>
  </ul>
  
  <p>Bonus points: Does the method of installing <code>node</code> affect the configuration? There are a <a href="https://gist.github.com/isaacs/579814" rel="noreferrer">lot of options</a>.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: I figured out that symlinks were being created in my <code>/usr/local/bin</code>, but my <code>.bash_profile</code> was setup with <code>/usr/local/share/npm/bin</code> ahead of <code>/usr/local/bin</code> in my <code>$PATH</code>. I vaguely remember adding that path to my profile at some point, but I'm not sure why.</p>
  
  <p>So the question now becomes: how did I end up with two different <code>node_modules</code> directories on my computer and why would I want to have my <code>node_modules</code> in the <code>share/npm/lib</code> subdirectory instead of right in <code>/usr/local/lib</code>? </p>