Install Node. js and NPM module management on Windows

Source: Internet
Author: User
Tags install node

In May September, I wrote an article about how to manually manage Node. js Modules on the Windows platform [install the Node. js module on Windows]. At that time, on the one hand, I had limited understanding of Node. js, and it was really troublesome to deploy Node. js on the Windows platform, so I chose to manually manage the Node. js module.

Now the situation has changed significantly. On the one hand, Node. js has completed the transformation of the port-based network model on the Windows platform, and on the other hand, NPM can work well on the Windows platform. Therefore, it is easier to deploy Node. js on the Windows platform. The following describes my operation steps.

1. Download the official Node. js program for Windows:

Http://nodejs.org/#download

Starting from 0.6.1, Node. js provides two installation methods on Windows. One is the. MSI installation file and the other is the. EXE executable file.

I selected the. EXE file. In addition to copying node.exe to the C: \ Program File (x86) \ directory and modifying the system Path, the. msiinstallation File has no other functions.

My version is 0.6.2: http://nodejs.org/dist/v0.6.2/node.exe

2. Create the D: \ nodejsdirectory and save node.exe in this directory. Add "D: \ nodejs" to the PATH of the system environment variable to facilitate node application execution at any location.

3. Download npm source code:

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

Note that at the time of writing this article, the latest npm version is 1.0.106, but this latest version and 1.0.105 have problems on the Windows platform. So I chose to install version 1.0.104:

Https://github.com/isaacs/npm/zipball/v1.0.104

4. decompress the npm source code to the D: \ npmjs directory.

In the Command Prompt window, perform the following operations to complete npm installation:

 
 
  1. D:\>cd npmjs  
  2. D:\npmjs>node cli.js install -gf 

In addition:

 
 
  1. Node cli. js install npm-gf // you can install the latest NPM version.
  2. Node cli. js install npm@1.0.105-gf // you can install the specified version of NPM

The above two methods are downloaded and installed from the code library through the network, but the code library generally only keeps the last two versions.

5. After NPM is installed, add "D: \ nodejs \ node_modules" to the system environment variable NODE_PATH.

6. Install express:

 
 
  1. Npm install express-g // install the latest version of express
  2. Npm install express@2.5.0 // install a specified version of express
  3.  
  4. Npm remove express-g // Delete express

For more npm usage, refer to npm Official Website: http://npmjs.org

Now the deployment is complete.

 
 
  1. D: \> node-v
  2. V0.6.2
  3.  
  4. D: \> npm-v
  5. . 0.104
  6.  
  7. D: \> express-v
  8. . 5.1
  9.  
  10. D: \> express hello // create an exrpess Project
  11. D: \> cd hello
  12. D: \ hello> node app. js // start

Open http: // localhost: 3000 in the browser and view the result.

Supplement: The npm source code package does not contain dependency modules. For easy installation, download is provided here:

Http://files.cnblogs.com/seanlv/node_modules.zip

After downloading, overwrite the node_modules folder in the npm directory.

Original article: http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.html

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.