最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to install NVM permanently on macos Catalina? - Stack Overflow

programmeradmin4浏览0评论

I did the installing part of nvm properly and put the path to the bash_profile also. On the same terminal it showed me that nvm is working. After that i closed my terminal and run "nvm" it shows that "zsh: mand not found: nvm". I need a solution for this.

I did the installing part of nvm properly and put the path to the bash_profile also. On the same terminal it showed me that nvm is working. After that i closed my terminal and run "nvm" it shows that "zsh: mand not found: nvm". I need a solution for this.

Share Improve this question edited Aug 5, 2020 at 6:34 macridmi1109 asked Aug 5, 2020 at 6:19 macridmi1109macridmi1109 611 silver badge5 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 7

first confirm if there is ~/.bash_profile and ~/.zshrc file, if not exist, run in order:

touch ~/.bash_profile
touch ~/.zshrc

then use below to install nvm

curl -o- https://raw.githubusercontent./creationix/nvm/v0.37.2/install.sh | bash

after installed, to add nvm dir to your env, run open ~/.bash_profile, add below two lines into the .bash_profile file:

source "$HOME/.nvm/nvm.sh"
export PATH=$PATH:$HOME/.nvm

close and reopen your terminal and run nvm -v to check if it works

NOTE: if it still not works, you may have to copy and run below mand manually in terminal

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_pletion" ] && \. "$NVM_DIR/bash_pletion"  # This loads nvm bash_pletion

You are adding the path to bash profile which is for bash terminal. Starting with MacOS 10.15 the default terminal is zsh. Either add the path to the ~/.zshrc or inside the same file put the following lines:

export PATH=$HOME/bin:/usr/local/bin:$PATH
source $HOME/.bash_profile

Don't forget to restart your terminal.

发布评论

评论列表(0)

  1. 暂无评论