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

Error: No such module was linked: electron_common_v8_util #100

Open
buaban opened this issue Nov 30, 2021 · 8 comments
Open

Error: No such module was linked: electron_common_v8_util #100

buaban opened this issue Nov 30, 2021 · 8 comments

Comments

@buaban
Copy link

buaban commented Nov 30, 2021

Description

An error occurs during NodeJS is including '.\server' from @electron/remote.
Error: No such module was linked: electron_common_v8_util

I am a software tester. I use Spectron to automate my tests on Electron applications.
Spectron has stopped using electron.remote and migrated to @electron/remote. However, it does not work on my machine.
When I start debugging my Typescript project (e.g. node runTest.js) that uses new version of Spectron, it will throw and error when it imports modules from Spectron and @electron/remote.

The error is thrown from the code below from @electron/remote/dist/src/common/get-electron-binding.js

const getElectronBinding = (name) => {
    if (process._linkedBinding) {
        return process._linkedBinding('electron_common_' + name); // <- Error thrown here
    }
    else if (process.electronBinding) {
        return process.electronBinding(name);
    }
    else {
        return null;
    }
};

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'
}

Platform

OS: Windows 10
Spectron: v.16
electron: 14.0.0
@electron/remote: v.2.0.1

Video record

Error-noModuleLinked-electron_common_v8_util.mp4
@squalle0nhart
Copy link

Same here. I'm using jest but got same error. Any suggestion ?

@squalle0nhart
Copy link

Ok i've found the solution to bypass this error for testing (with Jest) . The idea is give process correct dummy function for process._linkedBinding.

For jest:

  1. Add setup file in jest.config like this: setupFiles: ['/test/setupJest.js'],
  2. In setupJest.js write process._linkedBinding = (name) => name;

If you using spectron you can try to modify _linkedBinding function in proccess. It's should work.

@CheerTsai-tw
Copy link

Occured same uncaught error while getElectronBinding with
Windows 10
@electron/remote 2.0.8
[email protected]

any suggestion?

@dimaslanjaka
Copy link

same here

@johnitvn
Copy link

I'm using playwright and got same error

@RobertoValente2
Copy link

Same here btw

@cptDev6
Copy link

cptDev6 commented Mar 1, 2023

I am facing this with jasmine test case, any idea how to resolve

@thatkit
Copy link

thatkit commented Nov 27, 2023

I had the same bug and the reason was an exported variable in my main.ts file. When I remove the export declaration from it, every test got green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants