"Node.js" local mode installation Express: ' Express ' is not an internal or external command, nor is it a running program or a batch file. __js

Source: Internet
Author: User
Tags generator

Today I have nothing to think about node.js, so I downloaded a node.js installer to install on the Internet. which

Install Program: Node-v0.11.13-x64.msi
PC System: Windows 7
Custom Installation path: D:\TOOLS\NodeJs

After the installation is complete, execute:
D:\tools\nodejs>node-v
v0.11.13

Installation frame Express, download an installation document from the website, said installation Express can be divided into global mode and local mode, the individual feel that the global model is the default is not the meaning of the choice of local mode for installation, implementation:

D:\TOOLS\NODEJS>NPM Install Express

After installation, want to see the installed version, execute:

D:\tools\nodejs>express-v

' Express ' is not an internal or external command, it is not a running program or a batch file.

There is a problem, we have to solve it. First study, directly to find Baidu. Found the answer from the Internet, because the express default installation is the latest version, is already a 4.x.x version. In the latest express4.0+ version, the command tools are separated, so express-generator must be installed to perform:

D:\TOOLS\NODEJS>NPM Install Express-generator

Try to execute again:
D:\tools\nodejs>express-v
' Express ' is not an internal or external command, it is not a running program or a batch file.

Continue to Baidu, a lot of netizens said to configure environment variables, and even some netizens also give examples, after trying all wrong. Later found that most of the users in the installation of the use of the global model (environment variables do not have to do any modification), and then installed the express-generator after the problem. And I am the local mode, how to do. Netizens almost all adopt the global model, the local mode is very few. There is no way only to try to explore the global mode and local mode and express command path differences, Huang Tian, and finally found:

Global mode:
Install Express and Express-generator after the path:

C:\USERS\ADMINISTRATOR\APPDATA\ROAMING\NPM generates Express, express.cmd two files.

Local mode:
After installing Express and Express-generator in the path: D:\TOOLS\NodeJs did not generate Express, express.cmd two files. And in the path:

There is a. bin (generated when installing express-generator) there are express, express.cmd two files in the D:\TOOLS\NodeJs\node_modules.

Consider the local mode to modify the environment variables, and the Express command when the use of these two files will be related to it ... bin will not be the difference between the two. Then add in the System environment variable path: D:\TOOLS\NodeJs\node_modules\.bin
Try to execute again:
D:\tools\nodejs>express-v
4.2.0

It's done, haha. Here to share with you, hope to help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.