How to install node. js in windows

Source: Internet
Author: User
Tags install node
It is very convenient to install Node. js on Windows. You only need to visit the official node. js website http://www.nodejs.org/and click the downloadlink. Then choose windowsinstaller (32bit, 64bit optional ),

It is very convenient to install Node. js on Windows. You only need to visit the official node. js website http://www.nodejs.org/, click the downloadchain, and then select Windows Installer (32bit, 64bit optional) to download the installation package. After the download is complete, double-click the installation.

Installation steps:

Click "Next"

Accept the agreement and click "Next"

Select the installation directory and click "Next"

Select the component to be installed. By default, npm Package Manager is installed and environment variables are automatically added. Then, click "Next"

Click "Install" to start the installation. The installation progress bar appears. Click "Finish" to complete the installation.

Start node

We can start node in two ways:

Fang 1: double-click the node. js shortcut

Party 2: Open the windows command line. Because the environment variables have been automatically configured during installation, we can directly enter node to enter the node. js interaction mode.

Output "Hello, World !"

After entering the node, you can enter:

1 Console. log ("Hello, World! ");

Then we will see the output in the command line: Hello, World!

Next, let's test whether node. js can run correctly.

For example, create a node folder under drive D, create a test. js folder, open test, and enter the following code in js:

123456789 Var http = require ("http"); http. createServer (function (req, res) {res. writehead( 200, {"Content-Type": "text/html"}); res. write ("Node. js "); res. write ("

Hello World

"); Res. end ("

Beyondweb.cn

") ;}). Listen (3000); console. log (" HTTP server is listening at port 3000 .");

Then open the command line to enter your test. js directory, and then execute: node test. then open the browser and enter the address http: // 127.0.0.1: 3000/or http: // localhost: 3000 in the browser to run the testjs file.

The running effect is as follows:

OK. If there are no errors, the installation is complete.


This article was originally created by BeyondWeb.cn. If you need to reprint it, please use hyperlink to indicate the source: frontend development -BeyondWeb.cn

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.