Getting error while using Express with Node.js

I wrote a small program using npm express. while I am running the program i am getting error like below.(I am new to node.js)

module.js:340
    throw err;
          ^
Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (C:\Users\node\node_modules\app.js:1:77)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)

Inside your app you obviously require the express module, probably like this:

var express = require('express');

For this line to work you need to install Express into the local context of your application. To do so run

$ npm install express

inside your application's folder. This will (if it does not yet exist) create a folder node_modules where all your dependencies go.

Additionally, I'd suggest that you put Express into your package.json inside the dependencies block, such as:

"dependencies": {
  "express": "3.1.0"
}

Of course, you can adjust the version number to whatever version you use. Once you've done this for all of your dependencies, you can install them at once by simply running

$ npm install

That should fix it.

PS: It does not matter for this scenario whether you installed Express globally or not. A global installation is only good for having the express bootstrapper available system-wide. The require function always only searches within the local application context.