nvm Of GitHub In the documentation, we need to use the following command to install
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
But these two sites should be in foreign countries , Anyway, I tried many times but failed , The following is the correct installation idea .
find nvm Of releases, Then download the version you need ( Generally speaking , Just download the latest version )
Download it and put it in our user's home directory , If you don't know where the home directory is , Execute first
cd Re execution
pwd, Then decompress , Name the unzipped folder .nvm( Pay attention to that nvm)
Configure environment variables , linux What I said vim ~.bash_profile( If you have this file, add it to it , If not, build a new one ), Add the following
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"
If it is mac Words , It depends on the system version , If the system version is higher, it can be modified ~.zsh_profile file
Be accomplished , perform nvm -v see nvm edition