user203617
user203617

Reputation: 533

Running Express.js in Windows 7

I tried install express (using -g for global) in Windows 7 using

 npm install -g express

I get the following and no errors:

 npm http GET https://registry.npmjs.org/express
 ...
 npm http GET https://registry.npmjs.org/mime/-/mime-1.2.11.tgz
 npm http 200 https://registry.npmjs.org/mime/-/mime-1.2.11.tgz
 npm http 304 https://registry.npmjs.org/debug/0.8.0
 [email protected] C:\Users\xxx\AppData\Roaming\npm\node_modules\express
 ├── [email protected]
 ├── [email protected]
 ..    
 ├── [email protected] ([email protected])
 └── [email protected] ([email protected], [email protected])

When I type express, I get:

 'express' is not recognized as an internal or external command. 

Any idea why this would happen?

Upvotes: 3

Views: 3101

Answers (2)

Elbassel
Elbassel

Reputation: 454

Express is not meant to be run on command prompt. If you're trying to generate the base express project then you can use express-generator, you can install it using:

npm install -g express-generator

After success installtion, then to generate an express project:

  1. Go the directory on your hard drive.
  2. run the following command: express myProject
  3. It will generate the base project for you.
  4. using your command prompt go to the created folder by the previous command.
  5. you can run now your project using one of the following commands:

    npm start OR node myProject
    

Upvotes: 0

Kamyar Gilak
Kamyar Gilak

Reputation: 1042

I ran into the same problem on Windows 8.1 use this command

npm install -g express-generator

or

npm install -g express-generator@'version'

like

npm install -g express-generator@3

Upvotes: 5

Related Questions