Nodejs module “worker_threads” returning error “Error: The V8 platform used by this instance of Node does not support creating Workers”

痞子三分冷 提交于 2020-08-08 06:35:08

问题


I'm creating an app where I need to stop some code without doing all the buggy sleep forever methods, or creating an if statement in every function checking if the stop variable is true, so I decided to use worker_threads, but every time I use it, I get an error:

Error: The V8 platform used by this instance of Node does not support creating Workers

And I don't understand why. Is it because it's inside Electron, maybe?

Code:

const { Worker } = require("worker_threads");
const test = new Worker('./Test.js')

来源:https://stackoverflow.com/questions/57013013/nodejs-module-worker-threads-returning-error-error-the-v8-platform-used-by-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!