Node. js: The Node. js service set up in Windows 7 (to play with javascript on the server side, this is not a front-end js plug-in) _ javascript skills

Source: Internet
Author: User
Tags install node nameserver
What is Node. js? Return the server-side javascript? I will not explain this concept in this article. I can search for it myself to find out that server-side js is not a new technology, but a recent node. the popularity of js broke out. I will explain what node is in a later article. js. Here is just a pure setup, even the environment is not available, but what server-side js is playing, everything has become a floating cloud, let's first build an environment, enter a "hello world" page.
Yes, Build Windows 7You only need to follow me step by step, and you will be OK. You do not need to know too much details. That is not what we are concerned about now. Our primary goal is to build the environment, otherwise, there will be no next step.

  Step 1. DownloadNode. js is to be installed under Cygwin in windows. Download The Cygwin installer from the Cygwin website.

Cygwin Website:


  Step 2. Install

To install the Cygwin program, you only need to perform the next step.

On the Choose A Download Source Page, select "install from internet ".

On the Select Your Internet Connection page, Select> Direct Connect

Select "-" On the Choose A Download Site interface and select the downloaded image. We recommend that you use the Japanese website ending with. jp, which is faster.

Note: If you are installing it for the first time, a warning may pop up, regardless of whether you care about it, click OK.

  Step 3. Select the installation component

Note: because there are many components, we recommend that you search for them. Click the name to select the image. A small square is displayed after the image is selected, and X (Cross) indicates the image is selected.

  Devel category

Gcc-g ++: C ++ compiler

Gcc-mingw-g ++: Mingw32 support headers and libraries for gcc c ++

Gcc4-g ++: G ++ subpackage

Git: Fast Version Control System-core files

Make: The GNU version of the 'make' utility

Openssl-devel: The OpenSSL development environment

Pkg-config: A utility used to retrieve information about installed libraries

Zlib-devel: The zlib compression/decompression library (development)

  Editor category

Vim: Vi IMproved-enhanced vi editor

  Python Classification


Note: you only need to click the icon on the Right of Python to switch to Install.

  Web Classification

Wget: Utility to retrieve files from the WWW via HTTP and FTP

Curl: Multi-protocol file transfer command-line tool

After the next step, you will be prompted that many dependent components need to be installed. Simply follow the next step.

Note: Since all components are downloaded online, it may take a long time to wait.

  Step 4. Run ash.exe

After the installation is complete, an icon will be generated on the desktop (if you select an icon to be generated on the desktop). Do not run this icon!

Open the folder and go to the C: cygwinbin directory. This is the default installation directory. If you have modified the installation directory, go to the bin directory under cygwin's installation directory.

Run ash.exe

Execute the./rebaseall-v command in the pop-up command window.

After the command is executed, execute exit to exit ash.

  Step 5. Download and install Node. js

Run the Cygwin program on the desktop.

Enter the wget in the Command window and press Enter.

Note: I am writing this article about node. the latest version of js is node-v0.4.7, is node. js, you can go to node when reading this article. the js website can be replaced with the latest download path.

Node. js Website:

Enter the tar xf node-v0.4.7.tar.gz in the Command window, node-v0.4.7.tar.gz for your own version.

Enter the cd node-v0.4.7 in the Command window and press Enter.

Enter./configure in the Command window and press Enter.

Enter make in the Command window and press Enter.

Enter make install in the Command window and press Enter.

OK. Now you have installed node. js.

Enter node -- version in the Command window and press enter to check your node. js version.

  Step 6. Set DNS

Open the folder and go to the C: cygwinetc folder.

Manually create the resolv. conf file.

Use NotePad to open the newly created resolv. conf file and add the following



Save and close.

  Step End. Test whether Node. js can be run

Now that you have completed the setup, but you don't know if it can run correctly, let's write an example file to test it.

Create example. js in the C: cygwin directory


Var http = require ('http ');

Http. createServer (function (request, response ){

Response. writeHead (200, {'content-type': 'text/html '});

Response. end ('Hello World');

}). Listen (8888 );

Console. log ('server running at http: // 8888 /');

Save (Note: Save As UTF-8 format, otherwise a syntax error will be reported ).

Run cygwin and enter node/example. js in the Command window and press Enter.

Have you seen Server running at http: // 8888/

Do not close cygwin. Open your browser and visit http: // 8888/To see if the hello world page is displayed.

Related Article

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: 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.