amazon-linux-2023 icon indicating copy to clipboard operation
amazon-linux-2023 copied to clipboard

Question - nodejs has a dependency with nodejs20-npm

Open harvey-sg opened this issue 1 year ago • 1 comments

Hi, I was thinking about removing nodejs package (node v18) as I only need nodejs20. sudo dnf remove nodejs It shows a dependency with nodejs20-npm. Is it normal?

Screenshot

harvey-sg avatar Nov 10 '24 03:11 harvey-sg

Is it normal?

No, it is not. And by the way, the issue was fixed yet in November, in nodejs20-20.18.0-1.amzn2023.0.2

$ sudo dnf install -qy nodejs20

Installed:
  libbrotli-1.0.9-4.amzn2023.0.2.x86_64                    libuv-1:1.47.0-1.amzn2023.0.2.x86_64                  nodejs20-1:20.18.2-1.amzn2023.0.1.x86_64        
  nodejs20-docs-1:20.18.2-1.amzn2023.0.1.noarch            nodejs20-full-i18n-1:20.18.2-1.amzn2023.0.1.x86_64    nodejs20-libs-1:20.18.2-1.amzn2023.0.1.x86_64   
  nodejs20-npm-1:10.8.2-1.20.18.2.1.amzn2023.0.1.x86_64    openssl-1:3.0.8-1.amzn2023.0.18.x86_64               

$ rpm -q --changelog nodejs20
... skip ...

* Fri Nov 01 2024 Alexey Tsvetnov <[email protected]> - 20.18.0-1.amzn2023.0.2
- Fix a dependency on the previous version of nodejs
- Fix pretrans path to node_modules
- Fix a node_modules backup logic in the pretrans phase

... skip ...

Yeah, the fix is related to NodeJS 20, because NodeJS project has added a new script (deps/npm/bin/npm-prefix.js) that has /usr/bin/node in the shebang. Because it was new, several Linux distributions, which also do NodeJS namespacing, faced this issue. The path to node binary that wasn't namespaced brought a dependency on the default version of NodeJS (the one that Provides /usr/bin/node). In this case, it was a wrong dependency of nodejs20 on nodejs:

For example, this is the commit that fixed a similar issue in the Fedora's nodejs20 package: https://src.fedoraproject.org/rpms/nodejs20/c/ae324c31b121302b4abab712a93b8d4d9cfd7f93?branch=rawhide

vorakl avatar Mar 09 '25 00:03 vorakl