5

I have node.js installed and running fine on windows 7 computer. I run

> npm install -g express
> npm install -g express-generator
> npm install -g express-generator@3

and they all install successfully. But when I go to a new folder and try:

> express myproject

I get: 'express' is not recognized as an internal or external command, operable program or batch file

I see 'express', 'express.cmd', and 'node_modules' directory with 'express' and 'express-generator' folders in the C:\Users\ME\AppData\Roaming\npm directory

I added the npm directory to my PATH in case that was missed.

I tried all the solutions I could find:

'Express' is not recognized command (windows)

https://groups.google.com/forum/#!topic/express-js/Cr92_LC_pUk

what else can I try to get express working?

Community
  • 1
  • 1
Cbas
  • 6,003
  • 11
  • 56
  • 87

7 Answers7

4
  1. Set Your npm Path variable

    c:\Users\\AppData\Roaming\npm

  2. Restart Your CMD

cain
  • 709
  • 2
  • 10
  • 18
3

Check that you have the path to the express folder in the path. remember that you need to reopen cmd to apply the changes in the environment variables as modifying them does not modify the variables of the currently working processes, AFAIK. If you are changing system-wide environment variables, you may need to restart Windows.

You also may need to check if PATHEXT contains .CMD extension.

Alex Netkachov
  • 13,172
  • 6
  • 53
  • 85
  • It was probably the path variable because it worked when I reopened the cmd prompt - didn't know you had to do that, but I'll always restart my software before posting here from now on. – Cbas Jun 26 '14 at 01:34
  • That would fix the problem. i for one am unable to locate the globally installed express package on my windows 7. – eran otzap Jul 21 '16 at 20:56
2

Run the commad prompt as Administrator, this way express will be installed in to system32 and can be recongnized on the commant prompt.so just open command prompt as System administrator then install express globally withnpm install -g express you can then go to any folder and generate your apps with express

Samba
  • 181
  • 2
  • 4
2

If still its not working re-install the node.js and start express install process again.

npm install -g express
npm install -g express-generator
Jaison James
  • 4,414
  • 4
  • 42
  • 54
1

What worked for me was running

npm install -g express
npm install -g express-generator

from the command prompt with Administrator privileges. (If you run windows 8/10 you get this right clicking on cmd icon and choosing 'Run as administrator').

Vicki
  • 11
  • 2
1

I think you need to update node to the latest version then run the 3 commands mentioned earlier and it should work

npm install -g express npm install -g express-generator npm install -g express-generator@3

The key is to update node 1st!

Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
0

Above answer still did not solve the problem for me. However adding the path of .bin lies fixed it for me.