title: How to require node modules correctly in node.exe of node.js
body: <p>Recently there is a newer version of node.js which supports npm for windows.</p>
  
  <p>I followed the instructions <a href="https://github.com/isaacs/npm" rel="nofollow">here</a> 
  And i've installed socket.io successfully on windows through npm (though some failed, like JSDOM)</p>
  
  <p>However when I require the module the followings fails:</p>
  
  <pre><code>var io = require("socket.io").listen(1234); 
  </code></pre>
  
  <p>and also</p>
  
  <pre><code>var io = require("./lib/node_modules/socket.io/index.js").listen(1234);
  </code></pre>
  
  <p>Which shows "Cannot find module "socket.io"</p>
  
  <p>However this works:</p>
  
  <pre><code>var io = require('/NodeDev/lib/node_modules/socket.io/index.js').listen(1234);
  </code></pre>
  
  <p>Here is where my stuff are placed:</p>
  
  <blockquote>
    <p>folder socket.io : in D:\NodeDev\lib\node_modules\</p>
    
    <p>node.exe : in D:\NodeDev\bin\</p>
    
    <p>my script : in D:\NodeDev\TestProject\</p>
  </blockquote>