Node.js:Windows7 under the Node.js service (to play the server-side JavaScript bar, this is not a front-end JS plugin) _javascript Skills

Source: Internet
Author: User
Tags openssl install node nameserver version control system
Here is just pure build, even the environment is not, also play what server-side JS, everything has become a cloud, let us first set up an environment, input a "Hello World" page.
That's right Construction under the Windows7, you only need to follow me step-by-step, OK, do not need to know too much detail, that is not what we are now concerned about, we are now the primary goal is to build the environment, otherwise there is no next.

  Step 1 Download node.js under Windows is to be installed under Cygwin, go to Cygwin website to download Cygwin Setup program.

Cygwin website: http://cygwin.com/

Direct Download Address: Http://cygwin.com/setup.exe

  Step 2. Installation

Install the Cygwin program you have down, basically just the next step.

Select from Choose A Download Source interface-Install from internet

In the Select Your Internet Connection Interface Selection-"Direct Connect"

In Choose A Download Site Interface Selection-"This choice, is to choose the image of the download, recommended use." JP End of the Japanese website, faster

Note: If you are installing for the first time, you may be prompted with a warning, regardless of his, click OK.

  Step 3. Select Installation Components

Note: Because of the larger number of components, it is recommended that you use search methods to find. Click on the name to select, after selection, there will be a small box, which has X (fork) to indicate selected.

  Devel classification

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 classification

Vim:vi improved-enhanced Vi Editor

  Python classification

All

Note: All installed, you just click on 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

The next step will prompt you to have a number of dependent components to install, basically directly to the next step.

Note: Because components are downloaded online, it may be a bit long to wait.

  Step 4. Run Ash.exe

After installation, the icon will be generated on the desktop (if you choose to generate an icon on the desktop), note that it is not running this icon!

Open the folder, enter the C:cygwinbin directory, this is the default installation directory, if you have modified the installation directory, you go to the Cygwin installation directory in the bin directory.

Run Ash.exe

Executes the./rebaseall-v command in a pop-up command window

Wait for the command to finish execution exit exit Ash

  Step 5. Download and install Node.js

Run the Cygwin program on the desktop.

Enter the wget http://nodejs.org/dist/node-v0.4.7.tar.gz carriage return in the command window.

Note: I am writing this article is the latest version of Node.js is node-v0.4.7, http://nodejs.org/dist/node-v0.4.7.tar.gz Node.js is the download address, you read this article you can go to Node.js's website to get the latest download path to replace it

Node.js Website: http://nodejs.org/

Enter the Tar XF node-v0.4.7.tar.gz carriage return in the command window, node-v0.4.7.tar.gz the version you downloaded for yourself.

Enter the CD node-v0.4.7 carriage return in the command window.

Enter the./configure carriage return in the command window.

Enter make carriage return in the command window.

Enter make install carriage return in the command window.

OK, you've already installed the node.js.

Enter the node--version carriage return in the command window to see your node.js version.

  Step 6. Setting up DNS

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

Manually create the resolv.conf file.

Open the resolv.conf file you just created with Notepad and add the following

NameServer 8.8.8.8

NameServer 8.8.4.4

Save and close.

  Step end. Test whether Node.js can run

So you've built it, but you don't know if it's going to work correctly, so let's write a sample file to test it.

Establish example.js in the C:cygwin directory

Input

var http = require (' http ');

Http.createserver (function (request, response) {

Response.writehead ({' Content-type ': ' text/html '});

Response.End ('HelloWorld ');

}). Listen (8888);

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

Save (Note: Save as UTF-8 format, or you will report a syntax error).

Run Cygwin, enter node/example.js carriage return in the command window

Have you seen the server running at http://127.0.0.1:8888/

Do not close Cygwin, open the browser, visit http://127.0.0.1:8888/to see if there is a Hello World page.

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