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

Cannot be used with Electron on Windows #705

Open
fstojanovic opened this issue Sep 30, 2020 · 6 comments
Open

Cannot be used with Electron on Windows #705

fstojanovic opened this issue Sep 30, 2020 · 6 comments

Comments

@fstojanovic
Copy link

It would appear that it is not possible to run with Electron on Windows.

When run if built for node, the following message pops up :

App threw an error during load
Error: The module '\?\C:\Users{SNIP}\rclnodejs\build\Release\rclnodejs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 73. Please try re-compiling or re-installing
the module (for instance, using npm rebuild or npm install).
at process.func (electron/js2c/asar.js:138:31)
at process.func [as dlopen] (electron/js2c/asar.js:138:31)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:828:18)
at Object.func (electron/js2c/asar.js:138:31)
at Object.func [as .node] (electron/js2c/asar.js:138:31)
at Module.load (internal/modules/cjs/loader.js:645:32)
at Function.Module._load (internal/modules/cjs/loader.js:560:12)
at Module.require (internal/modules/cjs/loader.js:685:19)
at require (internal/modules/cjs/helpers.js:16:16)
at bindings (C:\Users{SNIP}\rclnodejs\node_modules\bindings\bindings.js:112:48)

When I try to rebuild it for Electron using electron-rebuild, the build always fails, due to missing headers and dependencies. Once I manually resolve all those errors and it finally builds, running it for electron gives : "rclnodejs.node" is not a module.

When run for Node, without Electron, it works as expected.

@minggangw
Copy link
Member

I haven't used rclnodejs with Electron, I think @koonpeng has some experiences with Electron env, @koonpeng would you please have a look at this issue? Have you ever met sort of the error? Some comments, hope it helpful

When run if built for node, the following message pops up :

I don't think it could be workable with nodejs build, as you saw was compiled against a different Node.js version using
was reported.

due to missing headers and dependencies.

What's the header missed? Is it ROS2 headers or what else?

running it for electron gives : "rclnodejs.node" is not a module.

Can you find the rclnodejs.node under the build/ folder? It seems that the lib doesn't get generated.

@koonpeng
Copy link
Collaborator

koonpeng commented Oct 2, 2020

There is a bug in the current version of electron which causes rclnodejs to not work, the fix is currently scheduled in v11 beta. Also, if you are loading rclnodejs in the renderer process you need to disable renderer reuse (there's a flag somewhere in electron api). This is because rclnodejs is not "context-aware" and reusing the same process can cause unexpected behaviours.

That being said, the error "rclnodejs.node is not a module" may be caused by some problems in the compilation process. You can start by checking if the file exists and see if there is any error messages during the compilation.

@minggangw
Copy link
Member

Thanks for @koonpeng 's quick explanation, that's helpful!

This is because rclnodejs is not "context-aware"

I think we could improve this?

@fstojanovic
Copy link
Author

@minggangw , @koonpeng

Thank you for your replies. I will keep you posted about the issue, soon I'll update this issue thread.
Also, it doesn't build for any Electron version, not just the current one.

@newcanopies
Copy link

newcanopies commented Jan 21, 2021

@koonpeng @fstojanovic does rclnodejs build with electron on WSL2 Ubuntu 20.04?

Thanks all!

@adeelarshad83
Copy link

@minggangw , @koonpeng

Thank you for your replies. I will keep you posted about the issue, soon I'll update this issue thread. Also, it doesn't build for any Electron version, not just the current one.

Hi @fstojanovic, are you able to resolve this issue

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

5 participants