List available Node.js versions available.
dnf module list nodejs
AlmaLinux 8 - AppStream
Name Stream Profiles Summary
nodejs 10 [d][x] common [d], development, minimal, s2i Javascript runtime
nodejs 12 [x] common [d], development, minimal, s2i Javascript runtime
nodejs 14 [x] common [d], development, minimal, s2i Javascript runtime
nodejs 16 [x] common [d], development, minimal, s2i Javascript runtime
nodejs 18 [x] common [d], development, minimal, s2i Javascript runtime
nodejs 20 [x] common [d], development, minimal, s2i Javascript runtime
Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled
As we can see above, nodejs 18 is disabled. Enable it with
sudo dnf module enable nodejs:18
Now we can install with
sudo dnf install nodejs
You may need to uninstall older versions.