Skip to content

Electron - Module did not self-register  #626

Closed

Description

@ybouhjira

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"
  },

Activity

  1. johnhaley81 commented on Jun 27, 2015

    @johnhaley81
    Collaborator

    Try adding the module as atom-shell

  2. ybouhjira commented on Jun 28, 2015

    @ybouhjira
    Author

    I tried and I got the same error.

  3. maxkorp commented on Jun 29, 2015

    @maxkorp
    Collaborator

    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.

  4. ybouhjira commented on Jun 29, 2015

    @ybouhjira
    Author

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

  5. jhansen-tt commented on Jul 2, 2015

    @jhansen-tt

    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.

  6. maxkorp commented on Jul 6, 2015

    @maxkorp
    Collaborator

    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?

  7. jhansen-tt commented on Jul 6, 2015

    @jhansen-tt

    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.

  8. maxkorp commented on Jul 6, 2015

    @maxkorp
    Collaborator

    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.

  9. ybouhjira commented on Jul 6, 2015

    @ybouhjira
    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

  10. No6things commented on Jul 17, 2015

    @No6things

    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"
       }
    
  11. No6things commented on Jul 20, 2015

    @No6things

    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

  12. maxkorp commented on Aug 24, 2015

    @maxkorp
    Collaborator

    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.

  13. lxw0109 commented on May 19, 2016

    @lxw0109

    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.

  14. maxkorp commented on Aug 18, 2016

    @maxkorp
    Collaborator

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

  15. added a commit that references this issue on Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions