Why Node.js matters for production
Node.js is the standard toolchain used to build modern web apps (React, Vite, Ant Design, etc.). Even when your final production app runs as static files on IIS, Node.js is what transforms your source code into an optimized production build (minified JavaScript/CSS, hashed assets, and a stable folder you can publish).
- Install dependencies (npm installs your project libraries).
- Build for production (
npm run buildcreatesdist/orbuild/). - Publish to IIS by pointing IIS to the output folder (and adding a
web.configrewrite if you use client routes). - Repeat each time you ship a new version.
Install Node.js on Windows Server
Recommended method: install the official Node.js LTS version using the Windows Installer (.msi).
LTS is stable and best for servers.
- Open the official download page: nodejs.org.
- Select LTS and download Windows Installer (.msi).
- Run the installer.
- Keep the default options, especially:
- Add to PATH (so you can run
nodeandnpmanywhere). - npm package manager (installed automatically).
- Add to PATH (so you can run
- When you see Tools for Native Modules, keep it checked if you want fewer dependency issues. (It installs build tools that some npm packages require.)
- Finish installation.
- Restart PowerShell (or reboot if the installer requests it).
Verify everything installed correctly
These checks confirm: Node is installed, npm is installed, PATH is correct, and your build toolchain can actually run. Run them in PowerShell (or CMD) after installing.
node -v
npm -v
You should see version numbers like v24.x.x and 10.x.x (versions may vary).
where node
where npm
Typically you will see paths like:
C:\Program Files\nodejs\node.exe and C:\Program Files\nodejs\npm.cmd.
If you don’t, restart your terminal (or reboot) and try again.
This proves npm is working and can download/install packages.
mkdir C:\temp\node-test
cd C:\temp\node-test
# Initialize a small npm project
npm init -y
If you see a new package.json created, npm is functioning correctly.
The final proof is building your real app: it ensures npm, build scripts, and any native dependencies work.
npm install
npm run build
After build:
• Vite projects usually generate dist\
• CRA projects usually generate build\
dist / build).
That folder is your production-ready website.
Publishing to IIS (production mindset)
Your “production build” is what you publish. It’s smaller, faster, and stable. This is how professional deployments work.
- Performance: bundles are minified and optimized.
- Cache & stability: hashed file names prevent broken caches.
- Consistency: the build output is predictable across environments.
- Security: you publish compiled assets, not your raw dev environment.
Always use official sources on production servers:
Tip: If your React app uses routes like /dashboard,
install URL Rewrite and use a rewrite rule to route requests to index.html.
- node not recognized close and reopen PowerShell, or reboot.
- npm install fails (node-gyp) install “Tools for Native Modules” (C++ tools + Python).
- Client routes 404 on IIS install URL Rewrite + add
web.configrewrite. - Permissions issues run terminal as Administrator for installs on servers.
-
node -vandnpm -vshow versions -
npm installcompletes without errors -
npm run buildcompletes and generatesdist/orbuild/ - IIS points to the output folder
- SPA rewrite works (no 404 when refreshing routes)