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

Uncaught Error: Module did not self-register #26

Open
Somebi opened this issue Mar 1, 2019 · 5 comments · May be fixed by #36
Open

Uncaught Error: Module did not self-register #26

Somebi opened this issue Mar 1, 2019 · 5 comments · May be fixed by #36

Comments

@Somebi
Copy link

Somebi commented Mar 1, 2019

Getting this error... removing node_modules or npm rebuild is not helping.
This error is thrown when i'm using threads (workers)

@mscdex
Copy link
Owner

mscdex commented Mar 1, 2019

Node version?

@mscdex
Copy link
Owner

mscdex commented Mar 1, 2019

node addons have to explicitly support workers for them to work in that scenario. The main reason for this is that some addons can have global state which would not work for multiple threads.

@Somebi
Copy link
Author

Somebi commented Mar 3, 2019 via email

@Somebi
Copy link
Author

Somebi commented Mar 3, 2019 via email

@mscdex
Copy link
Owner

mscdex commented Mar 3, 2019

Can you show an example of each?

@migolovanov
Copy link

migolovanov commented Aug 22, 2019

I have meet same issue when tried to require xxhash in thread (node v12.8.1, pull/30 applied). But was able to solve it by changing src/hash.cc:

11c11,13
< NODE_MODULE(addon, Init);
---
> NODE_MODULE_INIT() {
>   Init(exports);
> }

and re-build binary: cd build && make

Code to reproduce the issue:

(async () => {
  const { job, start, stop } = require('microjob');
  var XXHash = require('xxhash')
  await start();
  await job(() => {
      var XXHash = require('xxhash')
  })
})()

@yuche yuche linked a pull request Aug 5, 2020 that will close 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

Successfully merging a pull request may close this issue.

3 participants