For the complete documentation index, see llms.txt. This page is also available as Markdown.

โšกHow to install Node.js on Windows Server

Node.js brings JavaScript to the server side. It is the foundation for many modern web applications, API servers, and development tools. Installing it on Windows Server is straightforward.

Step 1: Download the installer

  1. Open your browser on the VPS

  2. Download the LTS version (the one with the long-term support label)

Step 2: Run the installer

  1. Double-click the downloaded .msi file

  2. Accept the license agreement

  3. Keep the default installation path (C:\Program Files\nodejs\)

  4. In the Custom Setup screen, make sure npm package manager is checked

  5. Check Automatically install the necessary tools (this adds Chocolatey and Python for native modules)

  6. Click Install

Step 3: Verify the installation

Open a new Command Prompt or PowerShell:

node --version
npm --version

You should see version numbers for both.

Step 4: Create a test project

Now create a simple web server. Create a file called server.js:

Run it:

Open your browser and go to http://localhost:3000. You should see the message.

Step 5: Open the port in the firewall

To access your Node.js app from outside the VPS, open port 3000:

Now try accessing http://your-server-ip:3000 from your own browser.

Step 6: Keep your app running with PM2

Node.js apps stop when you close the terminal. PM2 keeps them running and restarts them if they crash.

Install PM2 globally:

Start your app with PM2:

Save the process list so it restarts on reboot:

Install PM2 as a Windows service for automatic startup:

Or use the Windows Task Scheduler to run PM2 at startup.

Step 7: Installing Yarn (optional)

Some projects use Yarn instead of npm:

Step 8: Installing native build tools

If you plan to use packages that need native compilation (like bcrypt or sharp), you need the Windows Build Tools:

This installs Visual C++ build tools and Python. It takes a few minutes.

Managing multiple Node.js versions

If you work on projects that need different Node.js versions, use nvm-windows:

  1. Download the latest installer from github.com/coreybutler/nvm-windows

  2. Run the installer

  3. Open a new PowerShell as Administrator

Install multiple versions:

Switch between them:

Check the active version:

Common issues

"node is not recognized" Close and reopen your terminal. The PATH variable needs to refresh after installation.

Permission errors On Windows, avoid installing global packages with sudo equivalents. If you get EACCES errors, make sure you are running PowerShell as Administrator.

Port already in use If port 3000 is already taken, use a different port or stop the other application:

Useful npm commands

Command
What it does

npm init -y

Create a new package.json

npm install express

Install a package

npm install -g pm2

Install a package globally

npm update

Update all packages

npm outdated

Check for outdated packages

npm uninstall express

Remove a package

Conclusion

Node.js is installed and ready on your Windows VPS. You can now run JavaScript applications, API servers, and web apps. With PM2 managing your processes, they will stay online even after you disconnect.

Last updated