If you see zsh: command not found: node, Node.js isn't installed on your Mac.

The fastest fix:

brew install node

If you don't have Homebrew yet, keep reading.

Install Node.js

Option 1: Homebrew (Recommended)

First, install Homebrew if you haven't:

/bin/bash -c "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then install Node:

brew install node

Verify it worked:

node --version

Option 2: Download from nodejs.org

Go to nodejs.org and download the LTS version. Run the installer.

After installing, restart Terminal and try:

node --version

Option 3: Use nvm (Node Version Manager)

nvm lets you install and switch between Node versions:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

Restart Terminal, then:

nvm install node    # Install latest
nvm install 18      # Or install specific version

If You Already Installed Node

Check if it's a PATH issue

Node might be installed but not in your PATH:

which node

If this returns nothing, Node isn't in your PATH.

For Homebrew on Apple Silicon:

echo 'export PATH="/opt/homebrew/bin:\$PATH"' >> ~/.zshrc
source ~/.zshrc

For Homebrew on Intel:

echo 'export PATH="/usr/local/bin:\$PATH"' >> ~/.zshrc
source ~/.zshrc

For nvm:

Add this to your .zshrc:

export NVM_DIR="\$HOME/.nvm"
[ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh"

Then:

source ~/.zshrc

npm Comes with Node

When you install Node, you also get npm (Node Package Manager):

npm --version

If Node works but npm doesn't, see the npm troubleshooting article.

Verify Installation

node --version    # Should show v18.x.x or similar
npm --version     # Should show 9.x.x or similar

Test it works:

node -e "console.log('Hello from Node')"

Common Issues

"node: command not found" in a new terminal tab:

Your PATH isn't being loaded. Check that your .zshrc has the right exports, then run source ~/.zshrc.

Different Node version than expected:

Check where Node is coming from:

which node

Multiple installations (Homebrew, nvm, system) can conflict. Use nvm to control which version is active.

M1/M2 Mac issues:

Some older Node versions don't support Apple Silicon. Use Node 16+ for best compatibility.

Switch Node Versions (with nvm)

nvm install 18        # Install Node 18
nvm install 20        # Install Node 20
nvm use 18            # Switch to Node 18
nvm alias default 18  # Set default version

Uninstall Node

Homebrew:

brew uninstall node

nvm:

nvm uninstall 18

Manual install (from nodejs.org):

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/node

Keep Learning

Getting your development environment set up is the first step. The free course covers Terminal fundamentals to help you work more efficiently.

Check it out at Mac Terminal for Humans.