Ubuntu 安装 nodejs 22

可以使用官方提供的安装命令:Node.js — Download Node.js®

# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash

# in lieu of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
nvm install 22

# Verify the Node.js version:
node -v # Should print "v22.22.0".

# Verify npm version:
npm -v # Should print "10.9.4".

安装不同的版本

如果想需要安装最新的 LTS 版本。

可以使用命令:

nvm install --lts

进行安装。

node 的配置,现在已经非常简化。

1 Like