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:
D:\>cd npmjs
D:\npmjs>node cli.js install -gf
In addition:
Node cli. js install NPM-GF // you can install the latest NPM version.
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:
NPM install express-G // install the latest version of Express
NPM install express@2.5.0 // install a specified version of Express
NPM remove express-G // Delete Express
For more NPM usage, refer to NPM Official Website: http://npmjs.org
Now the deployment is complete.
D: \> node-V
V0.6.2
D: \> NPM-V
1.0.104
D: \> express-V
2.5.1
D: \> express Hello // create an exrpess Project
D: \> Cd hello
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.
Reprinted from: http://www.cnblogs.com/seanlv/archive/2011/11/22/2258716.html