How to install Node.js modules on Windows
However, there is news that Microsoft has contacted Node.js officials, and I believe there will be improvements soon.
So without installing Cygwin, is it possible to set up a Node.js environment on Windows for experimental development? I did a simple test using Node.js + express, and it is basically feasible.
The steps are as follows:
1. Download the official non-stable version of Node.js Windows executable program:
http://nodejs.org/#download
I used version 0.5.7 in the experiment: http://nodejs. org/dist/v0.5.7/node.exe
2. Create the c:nodejs directory and save node.exe in this directory
3. Download express. Because of dependencies, we also need to download: connect, qs, mime and jade (express default template system. If you use other template systems, you need to download the corresponding system)
Name Address Experimental Version
---------- -------------------------------------------------- ---
express: https://github.com/visionmedia/express 2.4.3
connect: https://github.com/senchalabs/connect 1.7.1
qs: https://github.com/visionmedia/ node-querystring 0.3.1
mime: https://github.com/bentomas/node-mime 1.2.4
jade: https://github.com/visionmedia/jade 0.15.4
4. Create c:nodejsnode_modules directory, and create [Module] directories respectively in this directory. Then compress the file downloaded in the previous step and copy the relevant files to the [Module] directory.
node_modules
|- connect <= connect: lib/*
|- express <= express: lib/*
|- jade <= jade: lib/*
|- mime <= mime: mime.js & types/*
|- qs <= qs: lib/*
5. In the c:nodejsnode_modules directory, create the following files:
connect.js
Content: module.exports = require('./connect/connect ');
express.js
Content: module.exports = require('./express/express');
jade.js
Content: module.exports = require('./jade/jade');
mime. js
Content: module.exports = require('./mime/mime');
qs.js
Content: module.exports = require('./qs/querystring');
6. Compress the downloaded express Copy the bin/express file in the package to the c:nodejs directory and rename it to express.js
7. Modify the express.js file, taking 2.4.3 as an example below:
7.1. Modify the mkdir function body
401: exec( 'mkdir -p ' + path, function(err){
->exec('md ' + path, function(err){
7.2. Modify mkdir function call
263: mkdir(path + '/public/javascripts' );
->mkdir(path + '\public\javascripts');
264: mkdir(path + '/public/images');
->mkdir(path + '\public\images');
265: mkdir(path + '/public/stylesheets', function(){
->mkdir(path + '\public\stylesheets', function(){
280: mkdir(path + '/views', function( ){
->mkdir(path + '\views', function(){
8. Create an express project:
c:nodejsnode.exe express.js -s hello
9. c:nodejsnode_modules*.* => c:nodejshellonode_modules
10. Run and test:
c:nodejsnode.exe helloapp.js
Open in the browser: http://localhost:3000 to view the results.
The test is now complete.
The test file is given below. In the test file, I also tested express session. You can open it in the browser: http://localhost:3000/session to view the results.
For more related articles on how to install Node.js modules on Windows, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



This article will give you an in-depth understanding of the memory and garbage collector (GC) of the NodeJS V8 engine. I hope it will be helpful to you!

The Node service built based on non-blocking and event-driven has the advantage of low memory consumption and is very suitable for handling massive network requests. Under the premise of massive requests, issues related to "memory control" need to be considered. 1. V8’s garbage collection mechanism and memory limitations Js is controlled by the garbage collection machine

Choosing a Docker image for Node may seem like a trivial matter, but the size and potential vulnerabilities of the image can have a significant impact on your CI/CD process and security. So how do we choose the best Node.js Docker image?

The file module is an encapsulation of underlying file operations, such as file reading/writing/opening/closing/delete adding, etc. The biggest feature of the file module is that all methods provide two versions of **synchronous** and **asynchronous**, with Methods with the sync suffix are all synchronization methods, and those without are all heterogeneous methods.

Node 19 has been officially released. This article will give you a detailed explanation of the 6 major features of Node.js 19. I hope it will be helpful to you!

How does Node.js do GC (garbage collection)? The following article will take you through it.

The event loop is a fundamental part of Node.js and enables asynchronous programming by ensuring that the main thread is not blocked. Understanding the event loop is crucial to building efficient applications. The following article will give you an in-depth understanding of the event loop in Node. I hope it will be helpful to you!

The reason why node cannot use the npm command is because the environment variables are not configured correctly. The solution is: 1. Open "System Properties"; 2. Find "Environment Variables" -> "System Variables", and then edit the environment variables; 3. Find the location of nodejs folder; 4. Click "OK".
