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

add @electron/rebuild to the dependencies #3736

Open
1 task done
sdetweil opened this issue Mar 5, 2025 · 8 comments
Open
1 task done

add @electron/rebuild to the dependencies #3736

sdetweil opened this issue Mar 5, 2025 · 8 comments

Comments

@sdetweil
Copy link
Collaborator

sdetweil commented Mar 5, 2025

What problem do you want to solve with this change?

modules which require hardware access (pir, sensors, ...)
use low level libraries that require binary compatibility with the node engine running. either
nodejs in serveronly mode
or electron in full mode

during module install the author must choose which mode the module will be used in. most 'assume' full electron mode

the older versions of er(electron rebuild) worked when loaded into the module node_modules tree, it somehow found the electron version. you could also specify a parameter.

the newer er versions do not successfully find the electron version unless it is located in the same node_modules folder

so module install fails, and things change every quarter on our release, and the default upgrade doesnt take this impact into account

my upgrade script does an npm install for all modules with dependencies. i wrote a post-install script used by most of the modules, which checks for er in the MagicMirror node_modules folder, and if not present installs it (now with the wrong npm name )

its not our users fault we keep whacking the system every quarter. and its not the module authors fault either

interestingly, in the serveronly mode, i haven't seen reported issues with chromium/firefox ering used as the browser, even when er done on latest electron level

What do you think is the correct solution?

ship the matching electron-rebuild library with magicmirror

we use it in test, so only have to move from devdependencies list to dependencies list

Participation

  • I am willing to submit a pull request for this change.

Additional comments

No response

@khassel
Copy link
Collaborator

khassel commented Mar 5, 2025

have to move from devdependencies list to dependencies list

if we do this (I'm still not convinced ...) we should move it beside electron to optionalDependencies:

	"optionalDependencies": {
		"electron": "^35.0.0"
	},

@sdetweil
Copy link
Collaborator Author

sdetweil commented Mar 5, 2025

yes, you are correct. that is really the right place

@sdetweil
Copy link
Collaborator Author

sdetweil commented Mar 5, 2025

most of our module developers are not developers, and our users know even less.

whats the harm in trying to add a little stability while we keep current

@KristjanESPERANTO
Copy link
Contributor

Which modules have the mentioned problem?

the newer er versions do not successfully find the electron version unless it is located in the same node_modules folder

Modules like MMM-KeyBindings already solved it 2018 (maybe even before) this way:

ELECVERSION=$(node -pe "require('../../node_modules/electron/package.json').version")
./node_modules/.bin/electron-rebuild -f -w evdev,udev -v $ELECVERSION

This works with old and new versions of electron-rebuild. I'm using this module with an evdev device without any issues.

Reading the electron version and than use it as parameter for electron-rebuild should work for other modules too, right? So maybe we only should tell the developers how to do it?

@sdetweil
Copy link
Collaborator Author

sdetweil commented Mar 5, 2025

keybinding has my postinstall, but it's
the wrong version of eb, so its doesn't work,
and screws any module later

mmm-navigate just had the problem

@sdetweil
Copy link
Collaborator Author

sdetweil commented Mar 5, 2025

find the modules w node_helpers, and use onoff,gpio

pir, touch, navigate,

@sdetweil
Copy link
Collaborator Author

sdetweil commented Mar 5, 2025

i would never have figured out your env
and i dont think it fair to put that on every
module maker to figure out each release

@KristjanESPERANTO
Copy link
Contributor

keybinding has my postinstall

Does it? It looks very different to yours.

the wrong version of eb

What's the right one? MMM-KeyBindings already uses @electron/rebuild.

and screws any module later

If someone (like me) uses only one module with electron-rebuild there is no problem?

find the modules w node_helpers, and use onoff,gpio

Yeah, but on my setup I don't use the gpio. So it's difficult to test it by myself.

whats the harm in trying to add ...

The harm could be that if we introduce it, module developers will build on it. If it turns out later that it wasn't the best solution, we'll have problems taking it back.

I am not against improving the situation. But before discussing a concrete solution, I would just like to understand better in which scenarios and why the problems occur. Perhaps there are other solutions.

But it shouldn't be up to me, I'm a non-expert when it comes to electron-rebuild. So your decision shouldn't depend on me. I'm just asking questions to understand it better 😀

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

No branches or pull requests

3 participants