I installed npm with nvm and the first time it went all great, now I tried to check npm version on Mac terminal an it shows:

% npm --version
zsh: command not found: npm

But using VSCode terminal with bash, with same command, shows:

npm --version

Is there a chance I installed the wrong way npm or nvm? Or is this a way I can tell Mac terminal to use bash instead of zsh?

  • Your PATH's are in sync. Run 'echo $PATH' in both zsh and bash. I'm sure there's something missing.
    – ErniePC12
    Nov 3, 2021 at 1:22
  • bash: /Users/myuser/.nvm/versions/node/v12.22.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin zsh: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    – Danny
    Nov 3, 2021 at 1:53

2 Answers 2


So your PAth's are not the same. This is what is causing your different terminals to not be in sync.

They both have this:

 bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 
 zsh:  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

But only your bash has this:


You should add that to your ZSH PATH. Since you don't have a .zshrc file, do the following in Terminal;

echo 'PATH="~/.nvm/versions/node/v12.22.1/bin:$PATH"' >> ~/.zshrc
  • Can you please instruct me on how to add that path to zsh? I'm quite new using MacOS and zsh. I've been reading that I must add $HOME/.nvm/versions/node/v12.22.1/bin to my .zshrc file but when I do cat to that file it doesn't exist. cat ~/.zshrc shows cat: /Users/myuser/.zshrc: No such file or directory. Should I create the file and add this PATH? Works the same way?
    – Danny
    Nov 3, 2021 at 4:43
  • No problem, check above, I edited the post.
    – ErniePC12
    Nov 3, 2021 at 13:12
  • I already execute that command in terminal and cat ~/.zshrc shows PATH="~/.nvm/versions/node/v12.22.1/bin:$PATH" but still showing command not found even after reseting terminal. Also echo $PATH still showing the same path showed in comment above.
    – Danny
    Nov 3, 2021 at 15:05
  • I checked echo $PATH again in zsh and it now show ~/.nvm/versions/node/v12.22.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    – Danny
    Nov 3, 2021 at 15:12
  • Type "where npm" in both zsh and bash, see where it is.
    – ErniePC12
    Nov 3, 2021 at 22:25

Just adding to this that: In my case I had node and nvm installed and it was working fine for a long time

nvm use 16 (my preferred node version) helped


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .