【Ubuntu 24.04】How to Install and Use NVM

下载

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

在这里插入图片描述

激活

  • Activate NVM: Once the installation script completes, you need to either close and reopen the terminal or run the following command to use nvm immediately.

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

在这里插入图片描述

Step 2: Installing Node.js using NVM

After installing NVM, you can install Node.js. NVM makes it easy to install any version of Node.js. To install the latest version, use:

  • 最新版本:

nvm install node

  • 安装指定版本:
To install a specific version of Node.js, you can do so by specifying the version number, for example:

直接use不行,得先install 才能use

在这里插入图片描述


root@k8s-master-pfsrv:/home/zhangbin/perfwork/01_ai/01_semantic-text2image-search/frontend# nvm install 21.5.0
Downloading and installing node v21.5.0...
Downloading https://nodejs.org/dist/v21.5.0/node-v21.5.0-linux-x64.tar.xz...
######################################################################## 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v21.5.0 (npm v10.2.4)
Creating default alias: default -> 21.5.0 (-> v21.5.0)
root@k8s-master-pfsr

在这里插入图片描述

Step 4: Setting a Default Node.js Version

  • To avoid having to manually switch versions every time you open a new terminal, you can set a default Node.js version with NVM:

nvm alias default <version_number>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

等风来不如迎风去

你的鼓励是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值