'Express' is not recognized command (windows)


Question

Okay I am running node on windows (7). Using npm I just installed modules to d:\ directory. Therefore my files structure looks like the following:

D:\
  -myproject
     -node_modules
        -.bin
        -express

However, when I am in this 'myproject' directory, I can't seem to run 'express' for example:

D:\myproject\express site
'express' is not recognized as an internal or external command, operable program or batch file.

Am I doing anything wrong?

1
39
11/25/2012 5:18:24 PM

Accepted Answer

My guess is that you didn't install Express globally. You can install express globally (and therefore available in your PATH) with the following command (see http://expressjs.com/guide.html) :

npm install -g express

The way you install it is available only in the folder that you installed it and there is nothing wrong with that approach. There is very little advantage of having it available globally.

If express is not in your PATH you can run it by entering the full path to it:

\myproject\node_modules\.bin\express.cmd
33
11/26/2012 2:15:21 PM

Try:

npm install -g express-generator@3

That solved problem for me.

Edit: for version 4

npm install express-generator -g

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon