February 2023 Archives

在rhel安装高版本nodejs

背景

RHEL8 尝试使用 slidev 的时候,安装提示node版本至少 >=14.0 ,而当前其nodejs版本是:

rpm -q nodejs nodejs-10.23.1-1.module_el8.4.0+645+9ce14ba2.x86_64

所以需要升级nodejs版本。

安装过程

在正常情况下,一般要么通过源代码编译解决,要么通过已打包好的安装包或对应软件仓库源来解决。这里介绍一种更加简单的方式。

首先,查看nodejs在当前仓库源下可用的版本:

```

sudo dnf module list nodejs Last metadata expiration check: 4:02:13 ago on Mon 27 Feb 2023 11:11:34 AM CST. CentOS Stream 8 - AppStream Name Stream Profiles Summary nodejs 10 [d] common [d], development, minimal, s2i Javascript runtime nodejs 12 common [d], development, minimal, s2i Javascript runtime nodejs 14 common [d], development, minimal, s2i Javascript runtime nodejs 16 common [d], development, minimal, s2i Javascript runtime nodejs 18 [e] common, development, minimal, s2i Javascript runtime

Extra Packages for Enterprise Linux Modular 8 - x86_64 Name Stream Profiles Summary nodejs 13 default, development, minimal Javascript runtime nodejs 16-epel default, development, minimal Javascript runtime

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled ```

其最高版本是18,那么需要先reset,然后设置18,命令行如下:

```

sudo dnf module reset nodejs -y sudo dnf module enable nodejs:18 -y ```

设置好对应高版本源后,开始安装:

```

sudo dnf install nodejs -y ```

即可完成nodejs版本的升级。

Monthly Archives

Pages

Powered by Movable Type 7.9.4

About this Archive

This page is an archive of entries from February 2023 listed from newest to oldest.

January 2023 is the previous archive.

March 2023 is the next archive.

Find recent content on the main index or look in the archives to find all content.