title: cannot find module express, how to install it to make it globally available?
body: <p>I want to experiment with some node.js stuff and I installed it yesterday following someone's instructions on the web which got it up and running, and I got the standard Hello World web page up on the screen. </p>
  
  <p>I now went to move onto another example, but in order to not clutter my home directory, I created a directory off of it (~/node) and created the files I needed in there. Low and behold, when it came time to run the service, I got no joy stating the <code>express</code> module couldn't be found. </p>
  
  <p>The instructions told me to install express using the <code>-g</code> flag, but that didn't help. I even ran it again without any luck.</p>
  
  <p>Now I've found this:
  <a href="https://stackoverflow.com/questions/10589177/cannot-find-module-express-socket-io-node-js">Cannot find module `express` | socket.io [node.js]</a></p>
  
  <p>and it appears I have to install it again under the current directory. I have done that and it works. Is it the case it has to be installed under each directory that I want services running from? It seems an unnecessary duplication. </p>
  
  <p>edit: </p>
  
  <p>Not knowing much about js I thought I would go digging and found</p>
  
  <p><code>app.use(express['static'](__dirname ));</code></p>
  
  <p>and have realised this is probably the cause of my problem. Further research has found this: <a href="http://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders" rel="nofollow noreferrer">http://nodejs.org/api/modules.html#modules_loading_from_node_modules_folders</a> and if I install it once in a higher level directory, that should 'solve' my problem. I'm not going to bother about uninstalling the module, but for my next project I will try it and see how it goes. </p>
  
  <p>I don't know why the original author suggested the <code>-g</code> flag when installing express, since it hasn't seemed to work for me. </p>