Error: No such module was linked electron_common_v8_util

Electron has removed remote module, and move it to electron-userland at @electron/remote. The last version of Spectron need to migrate to @electron/remote but there is an issue when Spectron includes the module.

const path = require('path');
const remoteMain = require('@electron/remote/main');
const WebDriver = require('webdriverio');

The code above is from spectron/lib/application.js. It shows the line of code that includes module from @electron/remote/main

const get_electron_binding_1 = require("../common/get-electron-binding");
const v8Util = get_electron_binding_1.getElectronBinding('v8_util');

The code above is from server.ts in @electron/remote/main/, it calls getElectronBinding('v8_util').

const getElectronBinding = (name) => {
    if (process._linkedBinding) {
        return process._linkedBinding('electron_common_' + name);
    }
    ...
};

The code above is function getElectronBinding that call _linkedBinding. This code will throw an error and the debugging ends here.

Here is the full error message.

Debugger attached.
Waiting for the debugger to disconnect...
internal/bootstrap/loaders.js:128
      mod = bindingObj[module] = getLinkedBinding(module);
                                 ^

Error: No such module was linked: electron_common_v8_util
    at process._linkedBinding (internal/bootstrap/loaders.js:128:34)
    at Object.getElectronBinding (d:\GIT\univeralcontainer\eikon-driver11\eikon-driver\node_modules\@electron\remote\dist\src\common\get-electron-binding.js:6:24)
    at Object.<anonymous> (d:\GIT\univeralcontainer\eikon-driver11\eikon-driver\node_modules\@electron\remote\dist\src\main\server.js:12:39)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:93:18)
    at Object.<anonymous> (d:\GIT\univeralcontainer\eikon-driver11\eikon-driver\node_modules\@electron\remote\dist\src\main\index.js:4:16) {
  code: 'ERR_INVALID_MODULE'
}
Error occurs while nodejs is including module remoteMain from require(‘@electron/remote/main’)

Leave a Reply

Your email address will not be published. Required fields are marked *