metarhia / noroutine

Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱
https://metarhia.com
MIT License
120 stars 11 forks source link

Relative path in noroutine.js #8

Closed Wansmer closed 2 years ago

Wansmer commented 2 years ago

Describe the bug In file 'noroutine.js' on line 102 path for './lib/worker.js' is relative. This leads to error: trying find this file in working directory instead of package folder.

Example:

node:internal/event_target:646
  process.nextTick(() => { throw err; });
                           ^
Error: Cannot find module '/Users/wansmer/projects/code/noroutine-sh/lib/worker.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at MessagePort.<anonymous> (node:internal/main/worker_thread:187:24)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (node:internal/worker:298:10)
    at Worker.[kOnMessage] (node:internal/worker:309:37)
    at MessagePort.<anonymous> (node:internal/worker:210:57)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28) {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

To Reproduce Install noroutine as a dependency to your project. Try run code from example from README.md

Desktop (please complete the following information):