Updated on 2026-07-29 GMT+08:00

Manually Deploying Node.js (Windows)

Description

This section guides you through the deployment of Node.js on a Windows ECS.

Node.js is a JavaScript runtime environment based on the Google Chrome's V8 engine. It helps you build responsive, scalable network applications easily. Based on the event-driven and non-blocking I/O model, Node.js is lightweight and efficient. It is ideal for running data-intensive real-time applications on distributed devices.

For more information about Node.js, see https://nodejs.org.

Windows Server 2022 and the Node.js software package node-v24.13.0-x64.msi are used as examples.

Prerequisites

Procedure

  1. Remotely connect to the ECS. For details, see Login Overview (Windows).
  2. Visit the Node.js official website, click Download on the top menu bar, and download the required installation package.
    Figure 1 Downloading the installation package
  3. Double-click the downloaded installation package and install Node.js as instructed.
    Figure 2 Installing Node.js
  4. Open a Command Prompt or Windows PowerShell window.

    Enter node -v and npm -v to view the version information. If the following information is displayed, the installation is successful.

    Figure 3 Checking versions
  5. Create a test project folder named TestFolder and a TXT file named test.txt.
    Figure 4 Creating a test file
  6. Double-click the test.txt file and copy the following content to the file.

    You can configure the project content (res.end) and port (const port) based on your service requirements. In this example, the port is 3000, and the output is Hello World.

    const http = require('http');
    const hostname = '0.0.0.0';
    const port = 3000;
    const server = http.createServer((req, res) => {
        res.statusCode = 200;
        res.setHeader('Content-Type', 'text/plain');
        res.end('Hello World\n');
    });
    server.listen(port, hostname, () => {
        console.log(`Server running at http://${hostname}:${port}/`);
    });
  7. Change the file name extension of test.txt to test.js.
    Figure 5 Changing the file name extension
  8. Open the Command Prompt or PowerShell window. Go to the TestFolder directory and run the npm init command to initialize the project.
    Figure 6 Initialization
  9. Enter the project name and other required information as prompted to generate the package.json file. If you do not want to set other parameters, press Enter to skip them.
    Figure 7 Project details
  10. Run the node test.js command to run the Node.js project locally.
    Figure 8 Running the project
  11. Add an inbound rule to the security group of the ECS to allow access to port 3000 configured in the project. To enhance security, you are advised to allow access only from specific IP address ranges instead of from all IPv4 addresses (0.0.0.0/0). For details, see Adding a Security Group Rule.
  12. On a local Windows server or any other Windows server that can access the Internet, open a browser and visit http://<ECS-EIP>:<project-port>. In this example, the project port is 3000.
    Figure 9 Access successful

    If the project cannot be accessed, check whether the security group port of the ECS is allowed or whether the Windows firewall is disabled.