Install express for node.js on Windows 7

Getting express working on Windows 7 did not work exactly as shown in the vast majority of tutorials/blogs that I found.

While simple, it requires an additional step or two.

Before we start, the following are the current versions of node and npm that I’m using on Windows 7:

node.exe -v
v0.6.10

npm -v
1.1.0-3

Open PowerShell, then type:

npm install express

Unfortunately, this installs express in:

C:\Users\Akbar\node_modules

If you try to start the node.js server with require(‘express’), node will be unable to find express.

To correct for this issue, do the following:

Open Windows Explorer to (replace Akbar with your user name): C:\Users\Akbar

Copy the node_modules folder.

Open the folder that contains your node app, such as: C:\my_node_app

Paste the node_modules folder.

That’s it. run the node server and everything should work fine.

node.exe .\app.js