简体   繁体   中英

Express JS command is not working

After installing Express with Node.js using this command:

npm install -g express

I am not able to use the express command, I get thrown the error in windows that express is not an internal or external command.

I've checked to make sure Express was installed by using the command npm -g ls and express shows up in there like this:

C:\wamp\www\blackbook>npm -g ls
C:\Users\Chris\AppData\Roaming\npm
└─┬ express@4.0.0
  ├─┬ accepts@1.0.0
  │ ├── mime@1.2.11
  │ └── negotiator@0.3.0
  ├── buffer-crc32@0.2.1
  ├── cookie@0.1.0
  ├── cookie-signature@1.0.3
  ├── debug@0.8.0
  ├── escape-html@1.0.1
  ├── fresh@0.2.2
  ├── merge-descriptors@0.0.2
  ├── methods@0.1.0
  ├── parseurl@1.0.1
  ├── path-to-regexp@0.1.2
  ├── qs@0.6.6
  ├── range-parser@1.0.0
  ├─┬ send@0.2.0
  │ └── mime@1.2.11
  ├─┬ serve-static@1.0.1
  │ └─┬ send@0.1.4
  │   ├── fresh@0.2.0
  │   ├── mime@1.2.11
  │   └── range-parser@0.0.4
  ├─┬ type-is@1.0.0
  │ └── mime@1.2.11
  └── utils-merge@1.0.0

Any ideas as to what I'm doing wrong or what I can do to fix it so I can use express?

I see you installed the latest Express.js version 4.0.0 . In this version they removed the application generation from express itself. This is now a separated module called express-generator .

To install it, use the following command

$ npm install -g express-generator

To read more, check out the Express.js docs #executable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM