OpenDeck icon indicating copy to clipboard operation
OpenDeck copied to clipboard

Node.js installed via nvm/fnm not detectable by OpenDeck

Open dowmeister opened this issue 9 months ago • 10 comments

Hello,

i'm trying to run my own SD plugin (that works on Windows) on OpenDeck

[2025-04-14][18:31:01][opendeck::events::frontend::plugins][WARN] Failed to initialise plugin at /home/dow/.var/app/me.amankhanna.opendeck/config/opendeck/plugins/com.trucky.sdplugin.sdPlugin: Node version 20.0.0 or higher is required, or Node is not installed
[2025-04-14][18:31:01][opendeck::events::frontend][ERROR] Node version 20.0.0 or higher is required, or Node is not installed

OS: Ubuntu 24.10 - Gnome OpenDeck latest version - installed via flatpak as user

I do have node installed. Initially it was installed only via nvm but then i've installed the official apt package but realized is still stuck at node 18 and then installed it via fnm as suggested on the node website.

dow@dow-ubuntu:~$ node -v
v22.14.0

dow@dow-ubuntu:~$ nvm list
       v18.20.2
       v20.19.0
->       system
default -> 20 (-> v20.19.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v20.19.0) (default)
stable -> 20.19 (-> v20.19.0) (default)
lts/* -> lts/jod (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.3 (-> N/A)
lts/gallium -> v16.20.2 (-> N/A)
lts/hydrogen -> v18.20.8 (-> N/A)
lts/iron -> v20.19.0
lts/jod -> v22.14.0 (-> N/A)

I can build my electron app and the SD plugin so.. node is definitely installed :D

dowmeister avatar Apr 14 '25 18:04 dowmeister

Please could you install OpenDeck from the .deb file instead of from Flatpak. I'm pretty sure that should fix the issue. If it doesn't, I'll reopen this issue.

nekename avatar Apr 16 '25 18:04 nekename

Gotta reopen this because also with the deb, same error.

I think would be useful, at least in logs, to show what node version has been detected, where is the node version called (in case of nvm or multiple installations) and what is the actual error from the plugin initialization.

dowmeister avatar Apr 17 '25 06:04 dowmeister

That's quite odd; here's the logic used

		let command = if std::env::var("container").is_ok() { "flatpak-spawn" } else { "node" };
		let extra_args = if std::env::var("container").is_ok() { vec!["--host", "node"] } else { vec![] };
		let version_output = Command::new(command).args(&extra_args).arg("--version").output();
		if version_output.is_err() || String::from_utf8(version_output.unwrap().stdout).unwrap().trim() < "v20.0.0" {
			return Err(anyhow!("Node.js version 20.0.0 or higher is required"));
		}

The Rust playground shows that "v22.14.0" < "v20.0.0" is false, so as long as node --version is outputting v22.14.0 to stdout I don't know what's happening (and this has worked for other users)

nekename avatar Apr 17 '25 11:04 nekename

I don't know... how we can be sure that node 22 has been detected and not eventually another version if it's not logged?

dowmeister avatar Apr 17 '25 12:04 dowmeister

Because it runs node --version and you showed the output of that command in your original post?

nekename avatar Apr 17 '25 12:04 nekename

I don't think it's so simple.

I have nvm installed and nvm interacts with the bash, are you sure when you execute node --version from Rust if the bash profile it's used?

honestly, I would log that precisely and see what is actually the output on my side

dowmeister avatar Apr 17 '25 17:04 dowmeister

Oh, I see. I kinda forgot how nvm (and fnm, which is what I used to use) worked, as I use Deno entirely now.

Maybe you could symlink the Node 22 into a directory in your PATH (/usr/bin maybe) and see if that helps? Because then OpenDeck should be able to find it.

nekename avatar Apr 17 '25 19:04 nekename

i'm sorry, i won't symlink node if i'm already using nvm.

dowmeister avatar Apr 18 '25 08:04 dowmeister

I'm not sure what to do then - how else would OpenDeck be able to find the installation, without starting a shell?

nekename avatar Apr 18 '25 12:04 nekename

@dowmeister do you have any suggestions for remedying this?

nekename avatar May 14 '25 07:05 nekename

I am also experiencing this issue. I'm not super familiar with node.js but I am running mint and trying to install the home assistant plugin into opendeck, it gives me the error that I need nodejs 20.0.0+, but mint's nodejs package currently maxxed out at 18.something,

So I went to the nodejs website and followed the install instructions to install nodejs 22 via nvm

In a bash shell I get this: node -v v22.16.0

But that's not what the system package manager has installed, that's what nvm has installed for me.. So opendeck still says failed install need nodejs 20.0.0+ :(

Not sure how to go about fixing this

Thank you for amazing software btw I appreciate everything y'all do

liquidthex avatar Jun 15 '25 05:06 liquidthex

@liquidthex

This works for me using fnm: sudo ln -s ~/.local/share/fnm/node-versions/<version>/installation/bin/node /bin/node

For nvm, it would be something like this: sudo ln -s ~/.nvm/versions/node/<version>/bin/node /bin/node

To undo the changes: sudo unlink /bin/node

nekename avatar Jun 15 '25 11:06 nekename