Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"npm: command not found" on fedora 38 #72

Open
jfhbrook opened this issue Jun 13, 2023 · 1 comment
Open

"npm: command not found" on fedora 38 #72

jfhbrook opened this issue Jun 13, 2023 · 1 comment

Comments

@jfhbrook
Copy link

Hello!

I was trying this tool out for a build on COPR, and I ran into an interesting bug on fedora 38!

So when I generate the spec file, the build requires looks like this:

BuildRequires: %{?scl_prefix_nodejs}npm
%if 0%{!?scl:1}
BuildRequires: nodejs-packaging
%endif

The scl prefix seems to include the version of node being used - so in this case, it wants nodejs20-npm, not nodejs-npm. In Fedora 37 this works fine, but on Fedora 38 it causes this error message:

npm: command not found

and I think why that's happening is that nodejs20-npm doesn't install /usr/bin/npm:

$ dnf repoquery -l nodejs20-npm | ag npm$
Last metadata expiration check: 1:54:37 ago on Mon 12 Jun 2023 04:43:08 PM AKDT.
/usr/lib/node_modules_20/npm
/usr/lib/node_modules_20/npm/bin/npm
/usr/lib/node_modules_20/npm
/usr/lib/node_modules_20/npm/bin/npm

That shim seems to be installed with the non-versioned package:

$ dnf repoquery -l nodejs-npm | ag npm$
Last metadata expiration check: 1:56:22 ago on Mon 12 Jun 2023 04:43:08 PM AKDT.
/usr/bin/npm
/usr/lib/node_modules_18/npm
/usr/lib/node_modules_18/npm/bin/npm
/usr/bin/npm
/usr/lib/node_modules_18/npm
/usr/lib/node_modules_18/npm/bin/npm

For the purposes of my build, I got it working with a little bit of sed:

cat "nodejs-${name}.spec" | sed 's/BuildRequires: %{?scl_prefix_nodejs}npm/BuildRequires: nodejs-npm/' > modified.spec
mv modified.spec "nodejs-${name}.spec"

but I think if I were to suggest a patch to npm2rpm, I'd say that you should instead use some macros to call /usr/lib/node_modules_20/npm directly, instead of calling npm and counting on that shim existing.

Cheers!

@Odilhao
Copy link
Member

Odilhao commented Jun 13, 2023

scl should not be used on F37 as well, the macro is probably present in the buildroot but it should not be used, we used scl in our packages for EL7, maybe it's time to drop SCL @ehelms 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants