Why Node.js is important
Node.js is the standard toolchain for modern web apps (React, Vite, Ant Design, Next.js). On macOS, it lets you install dependencies, compile code into an optimized production build, and publish only the final output folder.
- Develop locally.
- Build when ready:
npm run build. - Publish only
dist/(Vite) orbuild/(CRA). - Serve via IIS (static), Nginx/Apache (static), or run Node only when needed (SSR/API).
Before you start
macOS machines can be Apple Silicon (M1/M2/M3) or Intel. Both are supported. To check your CPU type:
arm64 = Apple Silicon (M-series), x86_64 = Intel.
Install Node.js on macOS
There are two recommended methods. Use Homebrew for easy upgrades, or use the official installer for a simple, guided setup.
If Homebrew is not installed, install it from the official website, then run:
brew upgrade node.
If you see “command not found: brew”, install Homebrew first (link on the right column).
- Download Node.js from the official website (LTS recommended).
- Select the macOS installer for your chip (Apple Silicon or Intel).
- Run the installer and keep defaults.
- Close and reopen Terminal after installation.
Double-check everything installed properly
Open Terminal and run:
You should see version numbers (example: v20.x.x). That confirms Node.js and npm are installed.
This confirms macOS is using the correct binaries:
Homebrew usually points to:
• Apple Silicon: /opt/homebrew/bin/node
• Intel: /usr/local/bin/node
If package.json is created, npm works correctly.
Inside your web project folder:
Most modern projects generate:
• Vite: dist/
• CRA: build/
dist/ or build/ to your server / IIS site folder.
Keep your dev sources private.
Recommended downloads
Use trusted sources only.
Choose LTS for stability and long-term production compatibility.
After installing Homebrew, you can install Node with:
brew install node
Troubleshooting
Common fixes if Terminal cannot find node/npm or builds fail.
- Close and reopen Terminal (PATH refresh).
- Run
which nodeagain. - If you installed via Homebrew, verify brew works:
brew -v.
This helps when Node exists but the environment is outdated or misconfigured.
Some npm packages compile native code. If you get build errors, install Xcode Command Line Tools:
After installing, try again: npm install.
Always download from official sources. Avoid unknown installers or third-party “bundles”.