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 - Module did not self-register #626

Closed
ybouhjira opened this issue Jun 27, 2015 · 14 comments
Closed

Electron - Module did not self-register #626

ybouhjira opened this issue Jun 27, 2015 · 14 comments

Comments

@ybouhjira
Copy link

I get this error when I try to require nodegit (version 0.4.1) in electron (version 0.28.3)

A JavaScript error occured in the browser process
Uncaught Exception:
Error: Module did not self-register.
    at Error (native)
    at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:137:20)
    at Module.load (module.js:351:32)
    at Function.Module._load (module.js:306:12)
    at Module.require (module.js:361:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/youssef/Desktop/test/node_modules/nodegit/lib/nodegit.js:8:12)
    at Module._compile (module.js:426:26)
    at Object.Module._extensions..js (module.js:444:10)

I added engines.electron in package.json BTW

  "engines": {
    "electron": "0.28.3"
  },
@johnhaley81
Copy link
Collaborator

Try adding the module as atom-shell

@ybouhjira
Copy link
Author

I tried and I got the same error.

@maxkorp
Copy link
Collaborator

maxkorp commented Jun 29, 2015

What's your build process? Can you walk me through how it's all built? Electron build processes are a bit odd compared to general node stuff, but I'm pretty familiar.

@ybouhjira
Copy link
Author

I just install nodegit using npm install and it says in the output that it's compiling it. Is that enough?

@jhansen-tt
Copy link

I'm seeing the same error. My 'npm install' appears to be building the nodegit.node binary from scratch because it can't find one for x64 linux on S3. Not sure if the nodegit.node file should be runnable, but when I try to run it I get a seg fault crash, and gdb isn't helpful on giving any more information. Any chance you can post an x64 Linux binary to S3, for Ubuntu Linux? Anything I can help with on debugging this? For now I have to revert back to 0.3.3.

My nodegit works great on Mac but that's because there's a binary out there on S3, but my custom-built binary for Linux is crashing.

@maxkorp
Copy link
Collaborator

maxkorp commented Jul 6, 2015

Just to verify, you're doing the build AFTER setting the engines field? That only has an effect at compile time, not at build time.

The .node file should be requirable. If you try requiring it in a normal node context, does that work?

@jhansen-tt
Copy link

I'm really sorry. The problem was that I was building a release on a build server with node 0.10, and then trying to run it on a separate server with node 0.12. Hopefully this will help anyone else that makes the same dumb mistake.

@maxkorp
Copy link
Collaborator

maxkorp commented Jul 6, 2015

Ah, that would do it.
I'm kind of suspecting something similar with the original posted issue as well, probably needing to put atom-shell before the build, but it happened afterwards.

@ybouhjira
Copy link
Author

Yes I'm doing the build after setting the engines field. and when I copy the node_modules directory and require nodegit in a normal nodejs script I have no error

@No6things
Copy link

i have the same issue on windows than @ybouhjira.

My backgound is that i just had 1 problem installing nodegit with npm, was the building of libssh2 (the file sys\iou.h couldn't be found), after some workaround using another libssh2 project, i got the complete build.

I've trying to run the app with Electron after rebuild the module with node-gyp but didn't work.

I have in my package.json

  "engines": {
    "atom-shell": "0.28.3"
   },
   "dependencies": {
     "nodegit": "nodegit/nodegit#rollback-libssh2"
   },
   "devDependencies": {
     "electron-rebuild": "^0.2.3"
   }

@No6things
Copy link

i figured out, the solution was to rebuild the module targeting different node header.
More info at
https://github.com/atom/electron/blob/master/docs/tutorial/using-native-node-modules.md

@maxkorp
Copy link
Collaborator

maxkorp commented Aug 24, 2015

Yeah, any native module will have to be pointed at different headers to rebuild, so in general that process should work for nodegit if it works elsewhere.

@lxw0109
Copy link

lxw0109 commented May 19, 2016

I'm a newbie. I tried the following commands.

lxw@lxw:16:56:29:mixJavaAndNode$ electron -v
v0.37.8
lxw@lxw:16:56:45:mixJavaAndNode$ ./node_modules/.bin/electron-rebuild -v 0.37.8
Couldn't find electron-prebuilt and no --node-module-version parameter set, always rebuilding
lxw@lxw:16:57:41:mixJavaAndNode$ electron .

It just works. But I have no idea why it works at all.

@maxkorp
Copy link
Collaborator

maxkorp commented Aug 18, 2016

Closing out all of these old electron-how-to issues.

@maxkorp maxkorp closed this as completed Aug 18, 2016
julianmesa-gitkraken added a commit to julianmesa-gitkraken/nodegit that referenced this issue Jan 11, 2022
Notes:
* Host Key RSA 256/512 support nodegit#536
* Client side key hash upgrading for RFC 8332
* Support for server-sig-algs, ext-info-c server messages
* Customizing preferred server-sig-algs via the preference LIBSSH2_METHOD_SIGN_ALGO

Credit: Anders Borum, Will Cosgrove
ianhattendorf added a commit that referenced this issue Feb 8, 2022
…e-libssh2

RSA SHA2 256/512 key upgrade support RFC 8332 #536 (#626)
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

6 participants