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

Worker Threads docs example not working #21830

Closed
slonka opened this issue Jul 16, 2018 · 1 comment
Closed

Worker Threads docs example not working #21830

slonka opened this issue Jul 16, 2018 · 1 comment
Labels
doc Issues and PRs related to the documentations. worker Issues and PRs related to Worker support.

Comments

@slonka
Copy link

slonka commented Jul 16, 2018

  • node v10.6.0
  • Darwin 17.5.0
  • Worker threads

Hello,

Running the example from https://nodejs.org/docs/v10.6.0/api/worker_threads.html#worker_threads_class_worker doesn't work. It fails with:

$ node --experimental-worker oncetest.js

events.js:167
      throw er; // Unhandled 'error' event
      ^
TypeError: require(...).once is not a function
    at Object.<anonymous> (/Users/krzysztof.slonka/projects/native-workers-playground/oncetest.js:13:29)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at MessagePort.port.on (internal/worker.js:425:27)
    at MessagePort.emit (events.js:182:13)
    at MessagePort.onmessage (internal/worker.js:66:8)
Emitted 'error' event at:
    at Worker.[kOnErrorMessage] (internal/worker.js:296:10)
    at Worker.[kOnMessage] (internal/worker.js:306:37)
    at MessagePort.Worker.(anonymous function).on (internal/worker.js:243:57)
    at MessagePort.emit (events.js:182:13)
    at MessagePort.onmessage (internal/worker.js:66:8)

I think it should be: parentPort.once right?

@addaleax addaleax added doc Issues and PRs related to the documentations. worker Issues and PRs related to Worker support. labels Jul 16, 2018
@addaleax
Copy link
Member

I think it should be: parentPort.once right?

Yes – This has already been fixed in the documentation on master, it just needs to be released :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. worker Issues and PRs related to Worker support.
Projects
None yet
Development

No branches or pull requests

2 participants