% npm -v
zsh: command not found: npm
If you just installed npm - "node package manager" on your Mac or Unix-like Operating System and you get "command not found" when you run any npm command on your Zsh shell, then the most common reason is that you missed setting the PATH for the npm binary.
Fix: If node/npm was installed via homebrew.
- Open Terminal App.
- Now on the ZSH shell prompt run the below command,
For Intel Chip:export PATH=/usr/local/share/npm/bin:$PATH
For M1/M2 ARM Chip:export PATH=/opt/homebrew/bin/npm/bin:$PATH - Refresh your zsh shell by either just typing zsh on the prompt or,
source ~/.zshrc - Now try the npm command,
% npm --version 9.6.7
This is not an AI-generated article but is demonstrated by a human on an M1 Mac running macOS Sonoma 14.0.
Please support independent contributors like Code2care by donating a coffee.
Buy me a coffee!


Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!