I am new to both Node JS and express, and I have just installed npm in Windows 7.
I have installed express using the global flag:
npm install -g expr
Run cmd as administrator. It solved the 'express' not found problem in my case
To fix this you need to use:
npm install -g express-generator@3
It has been updated from the previous command:
npm install -g express
This is all you need to do:
C:\node> npm install -g express-generator
You can find this and much more at this detailed start up tutorial.
I ran into the same problem on Windows 8.1. The express.cmd is not created, but I found the text file:
C:\Users\you\AppData\Roaming\npm\node_modules\express\Readme.md
It suggests to run this:
npm install -g express-generator@3
Which will download more stuff.
After that you can use express on the windows command prompt. It will be in your path ( C:\Users\you\AppData\Roaming\npm)
Edit:
express-generator@3
is now updated to express-generator@4
,
so use this instead,
npm install -g express-generator@4
The answer isn't complete, because the modules are installed in C:\Users\you\AppData\Roaming\npm
directory as stated above, and you cannot always access any module without, 1) linking it to your current project or 2) explicityly defining the NODE_PATH
system variable pointing your node to the right place in the system.
First method,
After installing the module (express
in our case), you can link it to your current project by going to your current project directory using cmd and executing below command,
npm link express
You will get a message like this if it is successfully linked,
D:\Project\node_modules\express -> C:\Users\Sufiyan\AppData\Roaming\npm\node_modules\express
(you cannot link directories without running cmd with Administrator privileges)
The second option is to create or update NODE_PATH system variable pointing your node to the right place in the system. Read this for details.
Also read this official Node.js documentation regarding the issue,
http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/
I had this problem, Seems though we use -g it's ignored.
I just copied contents of MyProject/source/vendor
to C:\Users\username\AppData\Roaming\npm
Copy only needed folders inside node_modules (like: express, express-generator, bower, yo, gulp and packages that should be in PATH).
This problem really bothers everyone (or windows users?), npm programmers should solve it!
npm link express
to link express from any directory to your project directory were node is, by default when you run npm install express
it would be installed in C:\Users\****\AppData\Roaming\npm\node_modules\express
, so you don't have to install express and other frameworks required to install each time in your project directory, instead you can point to your node i.e where you have your application.