0%

Install NVM in Ubuntu

1、There is basically no problem at this step of logging in to the cloud server
2、Enter the install nvm command:
1
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
3、There may be errors during installation:
1
#Failed to connect to raw.githubusercontent.com port 443

Reason: Due to some factors, GitHub’s domain name resolution was polluted.

Solution: modify the host file, the command is as follows

(1) Open the host file
1
sudo vim /etc/hosts
(2) Fill in the following
1
199.232.96.133 raw.githubusercontent.com
(2) Exit and save, and you can execute the second step again
4、Solve the problem

Entering the following commands If you still have problems.

1
nvm --version  

If prompted “nvm command not found”.

Solve the problem of “nvm command not found”.

Enter the “.nvm” folder,create a new file “.bash_profile”.

1
touch .bash_profile //create a new file
1
vim .bash_profile //open file

Enter the following

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

Then close the file and execute the file, terminal input:

1
source .bash_profile
5、Test result

terminal input::

1
nvm --version  //The version number appears to indicate a successful installation