Nodejs+express deployment process under Windows

Source: Internet
Author: User
Tags install node

1. Download the node. JS official Windows Edition program:

: http://nodejs.org/#download

After entering the page, select Download, then select either the Windows installer,32 bit or 64-bit according to your own configuration.

2. After the download is complete, double click on the installation, here tentative I was installed under the E:\NodeJs\ directory.

After the installation is complete, run node. js Command Prompt, enter node-v in the Prompt window, and the correct installation will output the current node. JS version number.

Here you can write a test program to test whether node. JS is working properly, with the following code:

var http = require ("http");
Http.createserver (function (request, response) {
Response.writehead ($, {"Content-type": "Text/plain"});
Response.Write ("Test Nodjs");
Response.End ();
}). Listen (8899);
Console.log ("Nodejs Start listen 8899 port!");

Save the above code to a text file and save as Test.js (directory location is optional).

In the node. js command Prompt, enter the directory where the file is located, and type node test.js.

Open http://127.0.0.1:8899/in the browser to see the output of test Nodjs, the Environment installation configuration is successful.

3. Download NPM Source code

: Https://github.com/isaacs/npm/tags

Extract the NPM source code into the E:\NPM directory (the directory can be placed at your own request).
Perform the following actions in the node. js Command Prompt window

E:\>CD NPM
E:\npm>node Cli.js INSTALL-GF

Or
Node Cli.js install NPM-GF//The latest version of NPM can be installed
After the NPM installation is complete, add "D:\nodejs\node_modules" to the system environment variable Node_path.
The current version number is displayed when the command Prompt window is entered npm-v installed correctly.

4. Install Express

Execute "NPM Install-g Express" on the command line waiting to download and complete the installation automatically. One way to test Express installation is to look at its version number, and execute the command "express-v" to output the version number normally, but in the event of an abnormal condition, "Express is not an internal or external command". There are two possibilities: one is to install node in the second step without adding environment variables, which will solve the environment variables added by node. Second, the Express 4.x version of the command tool is divided, you need to install a command tool, execute the command "NPM install-g Express-generator" After the completion of the test.



Nodejs+express deployment process under Windows

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.