zsh: command not found: nvm solution
I have installed nvm when using mac pro before
The specific operation process is configured in nvm
Under normal circumstances, it is completely fine
, but today I used the company’s computer, a MacBook Air,
and found that after I completed the configuration, nvm --version is already available,
but when I open iTerm or use nvm in a project, it will always report that
zsh: command not found
even the npm command does not work The method is to use
. I searched a lot on the Internet, but there is no effect. Of course, I finally solved it.
The details are as follows
- Add in ~/.bash_profile
sudo vim ~/.bash_profile
Add to
source ~/.bashrc
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
save and exit later
source ~/.bash_profile
If an error is reported and the file cannot be found, touch ~/.bash_profile
then re-execute the above code
Still reporting zsh: command not found
an error
found ~/.zshrc
if not found use
touch ~/.zshrc
Create a new file
, find # User configuration
and add it in the following line
source ~/.bash_profile
Then save and exit
source ~/.zshrc
At this time, you can use nvm in the terminal of iTerm, and
you can also open a new terminal in vscode to use nvm.
if if not
Try adding these at the bottom of .zshrc:
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH