distributions
distributions copied to clipboard
Debian packages missing nodejs alternative
Previous versions of the Debian nodejs packages contained a postinst
script which called update-alternatives
to set up /usr/bin/nodejs
, but recent versions no longer do this. As a result, scripts that depended on /usr/bin/nodejs
being present no longer function on newly built machines, while they do still work on machines that upgraded nodejs package from a version with that script.
I've spot checked a few:
-
nodejs_12.18.1-1nodesource1_amd64.deb does call
update-alternatives
- nodejs_12.22.6-1nodesource1_amd64.deb does not
-
nodejs_14.5.0-1nodesource1_amd64.deb does call
update-alternatives
- nodejs_14.17.6-deb-1nodesource1_amd64.deb does not
(I checked by downloading the .deb
file, running ar x ${file}
to extract it, extracting the control file with tar -xf control.tar.*
, and examining postinst
if present.)
This is closely related to #1095, which is asking about Ubuntu packages, but I'm not sure if packages for Debian are distinct.
As a workaround, users can manually run the command that used to be in postinst
:
update-alternatives --quiet --install /usr/bin/nodejs nodejs \
/usr/bin/node 50 \
--slave /usr/share/man/man1/nodejs.1.gz nodejs.1.gz \
/usr/share/man/man1/node.1.gz
This is still an issue with later stuff like ubuntu jammy with 14.20.0-deb-1nodesource1.deb
Was a really odd issue till I found this old bug.
Same thing just happened to us with nodejs_16.18.1-1nodesource1_amd64.deb
To me, that's a breaking change and shouldn't be included in a minor release.
I've just added nodejs
alternative to my install script.
if ! hash nodejs 2>/dev/null; then
update-alternatives --install /usr/bin/nodejs nodejs /usr/bin/node 50
fi