distributions icon indicating copy to clipboard operation
distributions copied to clipboard

Debian packages missing nodejs alternative

Open jasonaowen opened this issue 3 years ago • 3 comments

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:

(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

jasonaowen avatar Sep 20 '21 22:09 jasonaowen

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.

meramsey avatar Aug 17 '22 17:08 meramsey

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.

borys-p avatar Nov 14 '22 19:11 borys-p

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

szepeviktor avatar Jan 08 '23 13:01 szepeviktor