Error: No such module was linked: electron_common_v8_util
buaban opened this issue · 8 comments
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
Same here. I'm using jest but got same error. Any suggestion ?
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:
- Add setup file in jest.config like this: setupFiles: ['/test/setupJest.js'],
- 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.
Occured same uncaught error while getElectronBinding with
Windows 10
@electron/remote 2.0.8
electron@20.0.2
any suggestion?
same here
I'm using playwright and got same error
Same here btw
I am facing this with jasmine test case, any idea how to resolve
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