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

Electron: Loading non-context-aware native module in renderer #95

Open
alba-ado opened this issue Dec 14, 2021 · 8 comments
Open

Electron: Loading non-context-aware native module in renderer #95

alba-ado opened this issue Dec 14, 2021 · 8 comments

Comments

@alba-ado
Copy link

Hello, thank you very much for this library. I have been running this library with electron for quite some time now. However, as I decided to update my version of the electron, I found that it gives an error because of the N-API compatibility (I think). In the earlier versions of the electron, it was possible to turn this off by using

app.allowRendererProcessReuse = false;

However, they have removed this approach in the latest versions of the electron. How can we fix this problem? Or can you issue an update regarding the fix of context-aware modules?

Here is the full error message I'm getting:

Uncaught Error: Loading non-context-aware native module in renderer: '/home/ado/Projects/Electron/node_modules/@pokusew/pcsclite/build/Release/pcsclite.node

at process.func [as dlopen] (node:electron/js2c/asar_bundle:5)
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199)
at Object.func [as .node] (node:electron/js2c/asar_bundle:5)
at Module.load (node:internal/modules/cjs/loader:988)
at Module._load (node:internal/modules/cjs/loader:829)
at Function.c._load (node:electron/js2c/asar_bundle:5)
at Function.o._load (node:electron/js2c/renderer_init:33)
at Module.require (node:internal/modules/cjs/loader:1012)
at require (node:internal/modules/cjs/helpers:94)
at bindings (/home/ado/Projects/Electron/node_modules/bindings/bindings.js:112)

This problem is probably caused by using an old version of the bindings module. Is there any possibility that this could be fixed?

Thank you very much in advance

@alba-ado
Copy link
Author

Sidenote: Here is an issue on the electron page for this problem with other libraries, but they insist that it is the problem of the library repos to fix this; electron/electron#18397

@aigeth19
Copy link

I am dealing with the same problem, have you found any solutions?

@santigimeno
Copy link
Owner

Can you test if #96 fixes the issue? Completely untested patch

@aigeth19
Copy link

Thanks, that seems to fix it.

@alba-ado
Copy link
Author

Hello, I couldn't try the #96 because I'm using another library "nfc-pcsc" because it uses this library as a dependency and I couldn't manage to successfully change it. I know it is a bit risky, but can you merge and push this version into npm repository so we can use it? It doesn't seem like you've changed much. I think it should work just fine.

@aigeth19
Copy link

I was using it in a similar way as a dependency. You could try put the code in manually inside /pcsclite/src/addon.cpp and rebuilding nfc-pcsc.

@alba-ado
Copy link
Author

Oh, thank you! I didn't test very deeply but I can also confirm that #96 is working with the latest version of electron (16.0.4). Would be great if you could publish it in the npm though.

@bastianandre
Copy link

I can confirm that #96 works with Electron 17.1.0. Would be great, if this would be implemented!

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

4 participants