安裝nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
輸出
=> Downloading nvm from git to '/root/.nvm'
=> 正克隆到 '/root/.nvm'...
remote: Enumerating objects: 333, done.
remote: Counting objects: 100% (333/333), done.
remote: Compressing objects: 100% (283/283), done.
remote: Total 333 (delta 38), reused 150 (delta 25), pack-reused 0
接收對(duì)象中: 100% (333/333), 177.15 KiB | 182.00 KiB/s, done.
處理 delta 中: 100% (38/38), done.
=> Compressing and cleaning up git repository
=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.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
執(zhí)行命令查看版本
[root@master ~]# nvm -v
-bash: nvm: 未找到命令
執(zhí)行source命令生效
source ~/.bashrc
在此查看
[root@master ~]# nvm -v
0.35.3