1.一开始各种乱七八糟网上搜索方法安装都无法成功,主要网络问题,第二采用安装包下载安装不知道啥问题也安装不成功,然后添加了环境变量导致一直报错【You have $NVM_DIR set to "/home/wei/.nvm/nvm-0.39.1", but that directory does not exist. Check your profile files and environment.】,这个应该是系统缓存问题---(然后运行下面的重置一下)
unset NVM_DIR
2.采用了网上其他方法(如果没有clone下来多试几次)后来换成gitee秒下
- 注:具体安装路径根据自己喜好需求来,我是>>> cd /usr/local
git clone https://gitee.com/mirrors/nvm
然后cd usr/local/nvm中 ,然后运行下面的脚本
bash install.sh
需要多试几次才行,服务器国外的问题会中断或链接不上,最后出现变量配置,然后source一下即可
source ~/.bashrc
3.具体下面我运行的状态:
(base) wei@ubuntu:/usr/local/nvm$ bash install.sh
=> Downloading nvm from git to '/home/wei/.nvm'
=> 正克隆到 '/home/wei/.nvm'...
fatal: 无法访问 'https://github.com/nvm-sh/nvm.git/':GnuTLS recv error (-54): Error in the pull function.
Failed to clone nvm repo. Please report this!
(base) wei@ubuntu:/usr/local/nvm$ bash install.sh
=> Downloading nvm from git to '/home/wei/.nvm'
=> 正克隆到 '/home/wei/.nvm'...
remote: Enumerating objects: 360, done.
remote: Counting objects: 100% (360/360), done.
remote: Compressing objects: 100% (306/306), done.
remote: Total 360 (delta 40), reused 170 (delta 28), pack-reused 0
接收对象中: 100% (360/360), 219.83 KiB | 1.22 MiB/s, 完成.
处理 delta 中: 100% (40/40), 完成.
fatal: 无法访问 'https://github.com/nvm-sh/nvm.git/':Failed to connect to github.com port 443: 拒绝连接
Failed to fetch origin with v0.39.3. Please report this!
(base) wei@ubuntu:/usr/local/nvm$ bash install.sh
=> nvm is already installed in /home/wei/.nvm, trying to update using git
=> fatal: 无法访问 'https://github.com/nvm-sh/nvm.git/':Failed to connect to github.com port 443: 拒绝连接
Failed to update nvm with v0.39.3, run 'git fetch' in /home/wei/.nvm yourself.
(base) wei@ubuntu:/usr/local/nvm$ cd /home/
(base) wei@ubuntu:/home$ cd wei/
(base) wei@ubuntu:~$ cd .nvm/
(base) wei@ubuntu:~/.nvm$ git fetch
fatal: 无法访问 'https://github.com/nvm-sh/nvm.git/':Failed to connect to github.com port 443: 拒绝连接
(base) wei@ubuntu:~/.nvm$ git fetch
fatal: 无法访问 'https://github.com/nvm-sh/nvm.git/':Failed to connect to github.com port 443: 拒绝连接
(base) wei@ubuntu:~/.nvm$ git fetch
(base) wei@ubuntu:~/.nvm$ git fetch
(base) wei@ubuntu:~/.nvm$ bash install.sh
=> nvm is already installed in /home/wei/.nvm, trying to update using git
=> * (头指针分离于 FETCH_HEAD)
master
=> Compressing and cleaning up git repository
=> Appending nvm source string to /home/wei/.bashrc
=> Appending bash_completion source string to /home/wei/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:
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
(base) wei@ubuntu:~/.nvm$ nvm
Command 'nvm' not found, but there are 13 similar ones.
(base) wei@ubuntu:~/.nvm$ nvm -v
Command 'nvm' not found, but there are 13 similar ones.
(base) wei@ubuntu:~/.nvm$ source ~/.bashrc
(base) wei@ubuntu:~/.nvm$ nvm -v
0.39.3