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.