How to Install npm (and Node.js) on Mac


First, check if you have Homebrew installed:

brew --version
  • If it shows a version (like Homebrew 4.x), you’re good.
  • If not, install Homebrew with: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Now install Node.js (npm comes automatically):

brew install node

After it installs, check versions:

node -v
npm -v

βœ… Now you have both node and npm installed.


🛠 Option 2: Install with Node Version Manager (nvm) (Advanced, Flexible)

If you want more control over your Node.js versions:

  1. Install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  2. Close and reopen your terminal, then run: nvm install node nvm use node
  3. Check: node -v npm -v

βœ… Now you can easily switch between Node versions too.


📦 Why npm is Missing

  • npm is bundled inside Node.js.
  • If Node.js isn’t installed → npm isn’t available either.
  • Sometimes a broken Homebrew or nvm setup can cause it.

🔥 Quick Troubleshooting

If you installed Node but still can’t find npm:

which node
which npm

These should show something like /usr/local/bin/node and /usr/local/bin/npm.

If it’s blank, your PATH is messed up, and I can help fix that too.


πŸ‘‰ Tell me if you want me to show you the super clean way using nvm (I personally recommend it for Mac users)! πŸš€
Would you like me to guide you through it?


Leave a Reply

Your email address will not be published. Required fields are marked *