First step: Download the installation file
: Official website http://www.nodejs.org/download/
Step Two: Install Nodejs
after the download is complete, double-click "node-v4.2.1-x64.msi", the installation process is basically directly "NEXT" is ok (window's installation MSI file will add the path system variable directly in the process, the variable value is your installation path )
After the installation is complete in cmd(win+r then enter cmd into) console input: node-v, the console will print out: v4.2.1, the version prompt indicates that the installation was successful.
Step Three: NMP installation
To test whether the installation was successful. For example, a version prompt indicates that the installation was successful.
mode, enter your Nodejs first sentence: "Hello World"-Enter: Console.log (' Hello World ').
Detours, so it is now necessary to list the records below.
's home directory, the "Node_global" and "Node_cache" two folders are created under Nodejs.
NPM configSetprefix "Xxxx/xxxx/node_global"
as well
NPM configSetCache"Xxx/xxxx\node_cache"
Step three: Install the relevant environment
All commands are globally installed (that is, the "xxx/xxx/node_global" set above) so that the installed packages are available under the current user and are accessible from all other locations on the disk. Comparative aspect. Otherwise, it is installed in the current directory and can only be used in the current directory.
Example:
Fourth Step: Configure environment variables
-
Because the module's default address is changed, the above user variables are changed (user variable "PATH" is modified to "C:\Program files\nodejs\node_global\"), or the use of module will cause the input command to appear " XXX is not an internal or external command, nor is it a program or batch file that can be run "this error.
-
Close cmd, open System dialog, "My Computer" right "properties"-"Advanced system Settings"-"Advanced"-"Environment variables".
Such as:
Enter the Environment Variables dialog box and create a new "Node_path" value under System variables: xxx/xxx/node_global/node_modules
(PS: This step is important, otherwise it will be reported that XXX is not an internal command)
Fifth step: Create a project
var http = require ("http"); Http.createserver (function (request, response) {Response.writehead (), {"Content-type": " Text/plain "}); Response.Write ("Hello World"); Response.End ();}). Listen (8888); Console.log ("Nodejs Start listen 8888 port!");
NODEJS Environment Construction