Bug 2230317

Summary: nodejs-nodemon cannot be installed with non-default nodejs version
Product: [Fedora] Fedora Reporter: Honza Horak <hhorak>
Component: nodejs-nodemonAssignee: Zuzana Svetlikova <zsvetlik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 38CC: hhorak, zsvetlik
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: nodejs-nodemon-2.0.3-9.fc38 nodejs-nodemon-2.0.3-9.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-06 01:19:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Honza Horak 2023-08-09 10:01:11 UTC
nodejs-nodemon requires /usr/bin/node, which is only provided by the default nodejs version. If I want to use it with e.g. nodejs20 only (and I can create a symlink /usr/bin/node myself), it's not possible, because nodejs (v18) package is pulled in as a dependency.

Reproducible: Always

Steps to Reproduce:
(run inside a Fedora 38 container image)
1. sudo yum install nodejs-nodemon nodejs20
2. rpm -qa|grep nodejs
3. sudo ln -s /usr/bin/node-20 /usr/bin/node 

Actual Results:  
$ rpm -qa|grep nodejs | sort
nodejs-18.16.1-1.fc38.x86_64
nodejs-docs-18.16.1-1.fc38.noarch
nodejs-full-i18n-18.16.1-1.fc38.x86_64
nodejs-libs-18.16.1-1.fc38.x86_64
nodejs-nodemon-2.0.3-7.fc38.noarch
nodejs-npm-9.5.1-1.18.16.1.1.fc38.x86_64
nodejs20-20.4.0-2.fc38.x86_64
nodejs20-docs-20.4.0-2.fc38.noarch
nodejs20-full-i18n-20.4.0-2.fc38.x86_64
nodejs20-libs-20.4.0-2.fc38.x86_64
nodejs20-npm-9.7.2-1.20.4.0.2.fc38.x86_64
ln: failed to create symbolic link '/usr/bin/node': File exists


Expected Results:  
$ rpm -qa|grep nodejs | sort
nodejs-nodemon-2.0.3-7.fc38.noarch
nodejs20-20.4.0-2.fc38.x86_64
nodejs20-docs-20.4.0-2.fc38.noarch
nodejs20-full-i18n-20.4.0-2.fc38.x86_64
nodejs20-libs-20.4.0-2.fc38.x86_64
nodejs20-npm-9.7.2-1.20.4.0.2.fc38.x86_64

Comment 1 Honza Horak 2023-08-09 12:06:11 UTC
Btw. there is a related discussion on a list:
A related discussion: https://lists.fedoraproject.org/archives/list/nodejs@lists.fedoraproject.org/thread/JDOUUBB5HQJUUKDPJFGEYAWYCY5S4P6I/

Anyway, a simple change in Requires proposed in https://src.fedoraproject.org/rpms/nodejs-nodemon/pull-request/1 is available in copr for testing:
https://copr.fedorainfracloud.org/coprs/hhorak/nodemon-for-all/build/6259945/

This allows me to do this in the container image:

$ curl -Lk https://copr.fedorainfracloud.org/coprs/hhorak/nodemon-for-all/repo/fedora-38/hhorak-nodemon-for-all-fedora-38.repo >/etc/yum.repos.d/hhorak-nodemon-for-all-fedora-38.repo

$ yum -y install nodejs-nodemon nodejs20

$ rpm -qa|grep nodejs
nodejs20-docs-20.4.0-2.fc38.noarch
nodejs20-libs-20.4.0-2.fc38.x86_64
nodejs20-full-i18n-20.4.0-2.fc38.x86_64
nodejs20-npm-9.7.2-1.20.4.0.2.fc38.x86_64
nodejs20-20.4.0-2.fc38.x86_64
nodejs-nodemon-2.0.3-8.fc38.noarch

$ ln -s /usr/bin/node-20 /usr/bin/node
$ ln -s /usr/bin/npm-20 /usr/bin/npm
$ ln -s /usr/bin/npx-20 /usr/bin/npx
$ ln -s /usr/lib/node_modules_18/nodemon /usr/lib/node_modules_20/nodemon

$ node -v
v20.4.0

$ nodemon --help
Usage: nodemon [options] [script.js] [args]
<further valid output>

Which makes the trick I need.

When we use Suggests: nodejs, this change should have no impact on what dependency is installed if no specific nodejs version is required -- if I run `yum install nodejs-nodemon` in an empty Fedora 38 container, I end up with nodejs 18 installed, which is what we want by default.

Comment 2 Fedora Update System 2023-08-28 19:58:40 UTC
FEDORA-2023-0d02e70b42 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-0d02e70b42

Comment 3 Fedora Update System 2023-08-28 19:59:08 UTC
FEDORA-2023-7f092fabcf has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-7f092fabcf

Comment 4 Fedora Update System 2023-08-29 01:21:46 UTC
FEDORA-2023-7f092fabcf has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-7f092fabcf`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-7f092fabcf

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2023-08-29 01:25:19 UTC
FEDORA-2023-0d02e70b42 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-0d02e70b42`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-0d02e70b42

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2023-09-06 01:19:04 UTC
FEDORA-2023-7f092fabcf has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2023-09-15 18:42:27 UTC
FEDORA-2023-0d02e70b42 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.