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

Viewed 1144

With my current project I run into the following error message when creating a worker:

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

I found a variety of posts here on SO with comments like these: It was added in nodejs v10.5.0.

Does anyone know whats going on?

$ process.versions
ares:'1.16.0'
brotli:'1.0.7'
chrome:'85.0.4183.39'
electron:'10.0.0-beta.14'
http_parser:'2.9.3'
icu:'67.1'
llhttp:'2.0.4'
modules:'82'
napi:'5'
nghttp2:'1.41.0'
node:'12.16.3'
openssl:'1.1.0'
unicode:'13.0'

main.ts

  win = new BrowserWindow({
    webPreferences: {
      nodeIntegrationInWorker: true,
      nodeIntegration: true,
      allowRunningInsecureContent: (serve) ? true : false,
    },
  });
2 Answers

Launch Workers from main.js

I had my Workers launching from my renderer.js and then I noticed a comment here (https://www.giters.com/nrkno/sofie-atem-connection/issues/125) that mentioned there's a bug that results in this V8 platform message when Workers are kicked-off outside of main.js.

In my particular case, it's not working fully yet, but I don't get this message any more and I think my outstanding problems are unrelated.

I had a similar error when I tried to use the worker pool in electron. I solved it by adding the {workertype: 'process'} when I create the worker pool as follows.

const pool = workerpool.pool('',  { workerType: 'process' });
Related