title: "cannot find module" when installing npm modules on windows
body: <p>I am new to NodeJS. I am trying to use npm on Windows 8.</p>
  
  <p>I have installed using <a href="http://chocolatey.org/" rel="nofollow noreferrer">chocolatey</a>, <code>cinst nodejs.install</code> (version <a href="http://chocolatey.org/packages/nodejs.install" rel="nofollow noreferrer">0.10.17</a>). I installed as administrator (and would prefer to run npm as a normal user).</p>
  
  <p>Node itself seems to be working, I can use the REPL to run simple programs.</p>
  
  <p>If I try to install something using npm, I get <code>cannot find module</code>:</p>
  
  <pre><code>&gt; node npm install express
  
  module.js:340
      throw err;
            ^
  Error: Cannot find module 'C:\Users\Klas\Documents\My Dropbox\mina egna\tech\node\webserver\npm'
      at Function.Module._resolveFilename (module.js:338:15)
      at Function.Module._load (module.js:280:25)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:901:3
  </code></pre>
  
  <p>I have read the answers on <a href="https://stackoverflow.com/questions/9587665/nodejs-cannot-find-installed-module-on-windows">Nodejs cannot find installed module on Windows?</a> but unfortunately it is still unclear to me what I have to do. </p>
  
  <p>I have tried setting <code>NODE_PATH</code>:</p>
  
  <ol>
  <li>In trying to follow <a href="https://stackoverflow.com/a/9588052/46194">this answer</a>, I have tried setting it to  <code>C:\Users\Klas\AppData\Roaming\npm\node_modules</code> (but I had to create both the <code>npm</code> and the subfolder <code>node_modules</code> myself)</li>
  <li>I have tried creating a folder <code>c:\node\node_module</code> (according to <a href="http://csell.net/2011/10/20/setting-up-npm-for-node-js-on-windows/" rel="nofollow noreferrer">this advice</a>, even though the installation did not even create a <code>c:\node</code> folder) and setting it to that.</li>
  <li>I have tried setting it to <code>C:\Program Files\nodejs\node_modules\npm\node_modules</code> (which did exist after installation)</li>
  <li>I have also tried to create a <code>node_modules</code> folder below the current working directory. As I understand it that is where local npm will be installed?</li>
  </ol>
  
  <p>None of these helped. So it seems to me that setting <code>NODE_PATH</code> is not the solution?</p>
  
  <p>Using the <code>-g</code> flag makes no difference (I would prefer not to use it).</p>
  
  <p>I get the same error both as normal user and as administrator (I would prefer to be a normal user).</p>
  
  <p>I get the same error no matter where I execute the command, except when I do it in  <code>C:\Program Files\nodejs</code>, where I get </p>
  
  <pre><code>basedir=`dirname "$0"`
         ^
  SyntaxError: Unexpected token ILLEGAL
     at Module._compile (module.js:439:25)
  </code></pre>