Command nvm not found and Command node not found after already installed nvm on MacOS?

ziyi_chu

Ziyi Chu

Posted on September 17, 2024

Command nvm not found and Command node not found after already installed nvm on MacOS?

Why do we see these types of errors?

Command nvm not found
Command node not found
Enter fullscreen mode Exit fullscreen mode

Because we didn't add the source lines to the correct shell startup script, that is, ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc, depending on the shell program you are using.

How do you find these startup scripts?

These files that begin with a "." are usually hidden, so you can't find them in the Finder, or by "ls" command.

Find hidden files in the Finder Window: Press Command-Shift-period

To find hidden files in terminal:

cd ~
ls -a ~
Enter fullscreen mode Exit fullscreen mode

Source lines to add

//source line added
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
Enter fullscreen mode Exit fullscreen mode

Reference:
1.https://blog.logrocket.com/how-switch-node-js-versions-nvm/
2.https://discussions.apple.com/thread/254493189?sortBy=rank

💖 💪 🙅 🚩
ziyi_chu
Ziyi Chu

Posted on September 17, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related