# Ubuntu 安装 NodeJS 22 版本

**URL:** <https://www.isharkfly.com/t/ubuntu-nodejs-22/14080>\
**Category:** DevOps\
**Tags:** nodejs\
**Created:** [August 30, 2022, 1:07pm UTC](https://www.isharkfly.com/t/ubuntu-nodejs-22/14080 "2022-08-30T13:07:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://www.isharkfly.com/user_avatar/www.isharkfly.com/hex/32/21953_2.png) [@hex](https://www.isharkfly.com/u/hex)\
**Post date:** [August 30, 2022, 1:07pm UTC](https://www.isharkfly.com/t/ubuntu-nodejs-22/14080/1 "2022-08-30T13:07:45Z")

</div>

Ubuntu 的默认 NodeJS 版本实在是太低了。

现在应该安装 NodeJS 的 22 版本。

```auto
# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/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.14.0".
nvm current # Should print "v22.14.0".

# Download and install Yarn:
corepack enable yarn

# Verify Yarn version:
yarn -v

```

 ![2025-03-30_20-31-10](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/5/8/58abc7010b5c57cf894654fe9bac0fa496c6d5cf.jpeg)

安装成功后的版本信息如下：

 ![2025-03-30_22-32-11](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/9/f/9feaa28a9e016a856c4ef982135cfc9b53dcecdc.jpeg)
