Fedora used to have fancy modules for things like node, which allowed fast install and switch of a specific version: https://developer.fedoraproject.org/tech/languages/nodejs/nodejs.html e.g. with dnf module install nodejs:8

This is no longer the case starting with Fedora 38: https://fedoraproject.org/wiki/Changes/NodejsRepackaging – which suggests to install an alternative [supported] version e.g. with dnf install nodejs18. While this works it did not adjust the default link of /usr/bin/node to nodejs18, like the old command would have done, so ANY not-packaged-for-Fedora project will still default to /usr/bin/node, which points in my case to node-20 at the time of writing. The article suggests to make use of the update-alternatives command to change this but it does not give an example.

And since I will forget this by tomorrow here is one, that adds a new entry for node to alternatives and adds a symlink for /usr/bin/node to /usr/bin/node-18 with a priority of 18:

> sudo update-alternatives --install /usr/bin/node node /usr/bin/node-18 18
> update-alternatives --list

Should there be one with a higher priority already, and the list not update with the command, it has to be overridden with a manual setter:

> sudo update-alternatives --set node /usr/bin/node-18
> update-alternatives --list

yw.

Leave a Reply