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

Module did not self-register when importing midi in a worker #161

Closed
Lokua opened this issue Feb 14, 2020 · 1 comment
Closed

Module did not self-register when importing midi in a worker #161

Lokua opened this issue Feb 14, 2020 · 1 comment

Comments

@Lokua
Copy link

Lokua commented Feb 14, 2020

Hello. It seems node-midi is impacted by the issue linked below, which appears to have a fix contained within:

nodejs/node#21783

Short of it is I receive Module did not self-register when importing midi in a worker. Happy to produce a repro case if that helps, really it's just two files: one that launches the worker, and a worker script that imports midi.

Here is the error I receive for context:

events.js:187
      throw er; // Unhandled 'error' event
      ^
Error: Module did not self-register: '/Users/foo/app/node_modules/midi/build/Release/midi.node'.
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1190:18)
    at Module.load (internal/modules/cjs/loader.js:976:32)
    at Function.Module._load (internal/modules/cjs/loader.js:884:14)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at require (internal/modules/cjs/helpers.js:69:18)
    at bindings (/Users/foo/app/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/Users/foo/app/node_modules/midi/midi.js:1:31)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
    at Module.load (internal/modules/cjs/loader.js:976:32)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (internal/worker.js:187:10)
    at Worker.[kOnMessage] (internal/worker.js:197:37)
    at MessagePort.<anonymous> (internal/worker.js:125:57)
    at MessagePort.emit (events.js:210:5)
    at MessagePort.onmessage (internal/worker/io.js:70:8)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @foo/[email protected] start: `NODE_OPTIONS=--no-warnings node demo/index.mjs`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @foo/[email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/foo/.npm/_logs/2020-02-14T05_35_40_727Z-debug.log

Sidenote: I was importing this package in a worker because I wanted to see if that would cause this package not to take control of the terminal (I have no idea, was just stabbing in the dark). If anyone has an idea how I can open an input port and maintain ability to read terminal input without using separate processes or threads I'd be grateful.

@Lokua
Copy link
Author

Lokua commented Feb 14, 2020

My apologies. Got so used to working with experimental modules in node 13 that I didn't think to check if that was the cause. Using common-js and everything is fine. Please feel free to close.

Edit: everything is fine in workers regardless of mjs/cjs. Something else is wrong in my program. I need some sleep.

@Lokua Lokua closed this as completed Feb 14, 2020
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

1 participant