title: Nodejs require different module depending on directory structure
body: <p>I have two node projects who use the same directory:</p>
  
  <pre><code>projectA/
   |- app.js 
   |- projectB/
       |- app.js  
       |- node_modules/ 
             |- moduleX : version 1
   |- commonDir/ 
     |- commonModule.js
   |- node_modules/ 
     |- moduleX : version 2
  </code></pre>
  
  <p><code>commonModule.js</code>:</p>
  
  <pre><code>    require("moduleX")
  </code></pre>
  
  <p>Both <code>projectA</code> and <code>projectB</code> do <code>require(commonModule)</code>. I expected that when I run <code>projectA</code> ( "node app" form 'projectA/'), version 2 will be loaded, and when I run <code>projectB</code>("node app" form 'prjoctB/') version 1 will be loaded. Unfortunately, in both cases it seems to run version 2.</p>
  
  <p>Am I doing something wrong here?</p>
  
  <p><strong>EDIT:</strong>
  I understand now that the node searches for the module according to the current module which did the 'require()', which make sense..</p>
  
  <p>So, how can I choose on loading, which module version to run?</p>