node.js多版本管理器nvm的安装和使用

执行 下载安装命令

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
sunyuhua@sunyuhua-HKF-WXX:~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 15037  100 15037    0     0  23422      0 --:--:-- --:--:-- --:--:-- 23458
=> Downloading nvm from git to '/home/sunyuhua/.nvm'
=> 正克隆到 '/home/sunyuhua/.nvm'...
remote: Enumerating objects: 362, done.
remote: Counting objects: 100% (362/362), done.
remote: Compressing objects: 100% (311/311), done.
remote: Total 362 (delta 43), reused 159 (delta 25), pack-reused 0
接收对象中: 100% (362/362), 186.76 KiB | 394.00 KiB/s, 完成.
处理 delta 中: 100% (43/43), 完成.
* (头指针在 FETCH_HEAD 分离)
  master
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/sunyuhua/.bashrc
=> Appending bash_completion source string to /home/sunyuhua/.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

执行source 命令

source ~/.bashrc

检查是不是安装成功

nvm -v

nvm 的常用命令

nvm常用命令

nvm ls-remote  查看 Node 远程版本库
nvm install node  将安装最新版本的 Node
nvm install v12.7.0  将安装 12.7.0 版本的 Node
nvm uninstall v12.7.0  卸载 12.7.0 版本的 Node
nvm ls  查看已经安装的 Node 版本
nvm use v12.7.0 切换 12.7.0 为当前使用的版本
nvm alias default v12.7.0 将 12.7.0 设置为 Node 的默认版本
nvm which v12.7.0 查看 12.7.0 版本的 Node 的安装目录,比如:/Users/ccp/.nvm/versions/node/v12.7.0/bin/node
nvm --help  查看更多命令用法

其他相关命令

command -v nvm  查看 nvm 是否安装成功
node -v 查看当前使用的 Node 版本
which node  查看当前 Node 的安装目录
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MonkeyKing.sun

对你有帮助的话,可以打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值