title: node.js cannot find module xml2js
body: <p>I made an application on my machine, and it works well. I uploaded it to the server, and it is crashing with the following error:</p>
  
  <pre><code>node.js:116
          throw e; // process.nextTick error, or 'error' event on first tick
          ^
  Error: Cannot find module 'xml2js'
      at Function._resolveFilename (module.js:289:11)
      at Function._load (module.js:241:25)
      at require (module.js:317:19)
      at Object.&lt;anonymous&gt; (/var/www/node/price/index.js:3:14)
      at Module._compile (module.js:373:26)
      at Object..js (module.js:379:10)
      at Module.load (module.js:305:31)
      at Function._load (module.js:271:10)
      at Array.&lt;anonymous&gt; (module.js:392:10)
      at EventEmitter._tickCallback (node.js:108:26)
  </code></pre>
  
  <p>This is how my app starts:</p>
  
  <pre><code>var express=require('express');
  var http=require('http');
  var xml2js = require('xml2js');
  var sys = require('sys');
  var util = require('util');
  </code></pre>
  
  <p>I have installed both express and xml2js using npm. I have the exact same version (v0.4.0) for node on my machine and my server.</p>
  
  <p>I have made sure that the path wher xml2js and express reside (/usr/local/lib/node/) is included in the paths where node looks for modules. (I edited the file 'module.js' to print the paths where it is  looking for modules.)</p>
  
  <pre><code>node.js:116
          throw e; // process.nextTick error, or 'error' event on first tick
          ^
  Error: Cannot find module 'xml2js', in paths: /root/.node_modules,/root/.node_libraries,/usr/local/lib/node,/var/www/node/price/node_modules,/var/www/node/node_modules,/var/www/node_modules,/var/node_modules,/node_modules
      at Function._resolveFilename (module.js:289:11)
      at Function._load (module.js:241:25)
      at require (module.js:317:19)
      at Object.&lt;anonymous&gt; (/var/www/node/price/index.js:3:14)
      at Module._compile (module.js:373:26)
      at Object..js (module.js:379:10)
      at Module.load (module.js:305:31)
      at Function._load (module.js:271:10)
      at Array.&lt;anonymous&gt; (module.js:392:10)
      at EventEmitter._tickCallback (node.js:108:26)
  </code></pre>
  
  <p>So what is wrong? I have the right path, the module is there. Why can't node find it? And the exact same code runs smoothly on my local machine. If it matters, my machine is a Mac, and the server runs CentOS.</p>