先列出支持哪些版本
yum module list nodejs
AlmaLinux 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 [e] common [d] [i], 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
后面带[d]的就是默认安装的
用这个命令安装
yum module install nodejs
如果你要指定版本就像这样
yum module install nodejs:16
要卸载就用这个命令
yum module remove nodejs