MagicMirror icon indicating copy to clipboard operation
MagicMirror copied to clipboard

Electron 20 causes rebuild failures in epoll (used by all the GPIO modules, pir, etc)

Open sdetweil opened this issue 3 years ago • 4 comments

to recreate install MM switch to develop install MMM-PIR-Sensor

boom..

I opened this issue on epoll, which needs to drop nan and use node-addon-api but that means a near total rewrite.. SO.. its unlikely any time soon

(https://github.com/fivdi/epoll/issues/47, closed as dup of 42) was already on the list, as enhancement from a year ago https://github.com/fivdi/epoll/issues/42

here is the electron issue https://github.com/electron/electron/issues/18397

we cannot go above electron 19 at this time

sdetweil avatar Sep 04 '22 14:09 sdetweil

I see that MMM-PIR-Sensor-Lite uses python to get signals.. and installs ok as it doesn't use epoll https://github.com/grenagit/MMM-PIR-Sensor-Lite

the major PIR modules all appear archived..

sdetweil avatar Sep 04 '22 14:09 sdetweil

Hi, it's related to this MM topic

in my case not working with V20.x:

EXT-Pir: use epool library EXT-Detector: use node snowboy library Gateway: use node-pty EXT-MusicPlayer : use node usb

Naturaly, Other old modules (from other user) have same issue

bugsounet avatar Sep 04 '22 14:09 bugsounet

snowboy uses nan

latest node usb should be ok, removed nan

node-pty uses nan

epoll uses nan

sdetweil avatar Sep 04 '22 15:09 sdetweil

Perfect thx @khassel ;)

bugsounet avatar Sep 06 '22 22:09 bugsounet

any progress here?

Because:

End of Support for 19.x.y

Electron 19.x.y has reached end-of-support as per the project's support policy. Developers and applications are encouraged to upgrade to a newer version of Electron.

Quoted from https://releases.electronjs.org/releases/stable

khassel avatar Dec 02 '22 22:12 khassel

If for you it's really important... change it! My opinion does not count, I am not an official MagicMirror developer (or modules developer)

But do not warn at the last moment! I think that an special annonce in forum is needed

@bugsounet

bugsounet avatar Dec 03 '22 12:12 bugsounet

Infos:

Tested with electron v22.0.0

✔ MagicMirror Rebuild Complete

So should be ok (Most of sensible library)

bugsounet avatar Dec 03 '22 12:12 bugsounet

Thanks!

So I will update to electron v22 before next release.

khassel avatar Dec 03 '22 22:12 khassel

But is the original issue solved (electron rebuild failure) with electron v22?

And will the electron22 requirements be stricter again (fewer architectures supported for instance)?

rejas avatar Dec 04 '22 08:12 rejas

he has his own rebuild. we should ship electron-rebuild.

a secondary problem is that it needs to be installed in the mm node_modules folder. many apps install it locally in their module folder but that doesn't work anymore.

sdetweil avatar Dec 04 '22 12:12 sdetweil

he has his own rebuild. we should ship electron-rebuild.

it's +/- the same but simplified for MM²

a secondary problem is that it needs to be installed in the mm node_modules

I never do this

many apps install it locally in their module folder but that doesn't work anymore.

with electron-rebuild: ~/MagicMirror/modules/EXT-Pir$ ./node_modules/.bin/electron-rebuild ⠧ Building module: epoll, Completed: 0make: Entering directory '/home/bugsounet/MagicMirror/modules/EXT-Pir/node_modules/epoll/build' CXX(target) Release/obj.target/epoll/src/epoll.o ⠴ Building module: epoll, Completed: 0 SOLINK_MODULE(target) Release/obj.target/epoll.node ⠦ Building module: epoll, Completed: 0 COPY Release/epoll.node make: Leaving directory '/home/bugsounet/MagicMirror/modules/EXT-Pir/node_modules/epoll/build' ✔ Rebuild Complete

~/MagicMirror$ cat package.json | grep '"electron":'
                "electron": "^22.0.0"
~/MagicMirror$ cat package-lock.json | grep '"electron":'
                                "electron": "^22.0.0"
~/MagicMirror$ git branch
* develop

bugsounet avatar Dec 04 '22 13:12 bugsounet

@bugsounet that is because electron-rebuild is installed in the module folder..

if u install it in MM folder and then reference there from module folder it works

../../node_modules/.bin/electron-rebuild 

I have fixed a bunch of modules by making a postinstall script that does that.. vs hard coding electron-rebuild in package.json

for example here https://github.com/sdetweil/MMM-Buttons

sdetweil avatar Dec 04 '22 14:12 sdetweil

Are you really sure that install electron-rebuild in MM folder is a good choice ? I'm really not sure. You will make issue for updating MM² Most of users are lost with errors on updating

But it's your choice, make as you want ;) Developers have to done the better to catch any errors (and don't have a black screen)

Best way is installing electron rebuild in dependency of the module (make Electron Rebuild) on launch of MM² catch any error when loading the library and display the result (bypass black screen) sample:

image

But It's not the subject !

I am not a reference, My opinion does not count, I am not an official MagicMirror developer (or 3rd modules developer)

I leave you to make this decision alone Happy coding! @bugsounet

bugsounet avatar Dec 04 '22 14:12 bugsounet

But is the original issue solved (electron rebuild failure) with electron v22?

it is "solved" in the same way as with current v19, you have to use the rebuild of bugsounet.

And will the electron22 requirements be stricter again (fewer architectures supported for instance)?

what do you mean? There are 78 different download options on the release site as for other versions before.

It will be stricter concerning the browser because it contains a newer browser version.

I would like to test it on the develop branch now and if there are problems we can revert back to v19 before next release.

khassel avatar Dec 04 '22 21:12 khassel

what do you mean? There are 78 different download options on the release site as for other versions before.

I just remember vaguely that we were quite conservastive with upgrdaing electron in the past. Was that becuase of the spectron dependency or did that have other reasons too?

rejas avatar Dec 10 '22 07:12 rejas

from the change log:

mm 2.20 electron 19
mm 2.18 electron 16
mm 2.17.1 electron hotfix 13.5.1
mm 2.17 electron 13
mm 2.15 electron 11
before electron 3

So I think after upgrading to electron v11 we were not so conservative. We had luck with mm 2.17 because we were using a supported electron version because of the certificate bug (hotfix release 2.17.1).

Thats one reason why I'm not a friend of using an outdated electron version (which gets no updates anymore).

khassel avatar Dec 10 '22 15:12 khassel

in my opinion we don't need to be bleeding edge. we only have dhtml API calls and generally simple web content, one page, normal css. (altho I would like to see has() for css. )

iframes and such.

sdetweil avatar Dec 10 '22 16:12 sdetweil

22 does not cause this problem

sdetweil avatar Jan 03 '23 17:01 sdetweil