Installing Node.js on Windows is very convenient, we only need to visit Node.js official website http://www.nodejs.org/, click Download Link, then select Windows Installer (32bit,64bit optional) , download the installation package. When the download completes, double-click the installation directly.
Installation steps:
Click on "Next"
Accept the agreement and click "Next"
Select the installation directory and click "Next"
Select the components you want to install, default to the line, install NPM Package Manager by default, and add environment variables automatically, then click Next
Click "Install" to start the installation, then the installation progress bar appears, and finally click Finish to complete the installation.
Start Node
We can start node in two ways:
Fang Yi: Directly Double-click the Node.js shortcut
Side Two: Open windows command line, because the environment variable has been automatically configured at installation, so we can enter node directly to enter the Node.js interaction mode
output "hello,world!"
After we enter node, we can enter:
1 |
Console.log ("hello,world!"); |
And then we'll see the command line output: hello,world!
Next, let's test if Node.js can run correctly
For example, I set up a node folder under D disk, then create a test.js inside, open Test,js Enter the following code:
1 2 3 4 5 6 7 8 9 |
var http = require ("http"); Http.createserver (function (req, res) {Res.writehead ({"Content-type": "Text/html"}); Res.write (" |