-
Notifications
You must be signed in to change notification settings - Fork 46
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
TypeError: Cannot read properties of undefined (reading 'members') #79
Comments
Upgraded to v14.0.0, added the @electron/remote npm to dependencies: The previous working code no longer works: ERROR: I've tried both ways: and: |
Hello guys! On the migration doc (https://github.com/electron/remote/blob/main/docs/migration-2.md) none mention the required line of the previous major version: require('@electron/remote/main').initialize() I've deleted that on the main process cause I was thinking that was not required anymore. I use the code from @FedeIlLeone for give you an example. Main process: const { app, BrowserWindow } = require("electron");
const remoteMain = require("@electron/remote/main");
/* add this before the enable function */
remoteMain.initialize();
const win = new BrowserWindow({ ... });
remoteMain.enable(win.webContents);
win.loadFile("./build/web/index.html"); I hope that can help you all! |
Thank you! That fixed the issue.
I think it should be written that you have to use |
That worked! Thank you 👍 |
Doc should also mention needing the remote npm dependency: |
Documentation is still not clear enough that you need both the initialize and the enable. I had to search the closed issues on github to realize my mistake. |
@itsUndefined both are required with electron v16 and remote module @2.x as mentioned in the doc https://github.com/electron/remote/blob/main/docs/migration-2.md Thanks, @Valentina16 it works perfectly |
For me, after carefully doing the above,
Instead, I needed or Normally the typescript type system would squawk at a problem like this, so maybe this is just something weird in my setup. |
"In Electron 9, using the remote module without explicitly enabling it via the enableRemoteModule WebPreferences option began emitting a warning. In Electron 10, the remote module is now disabled by default. To use the remote module, enableRemoteModule: true must be specified in WebPreferences:" https://github.com/electron/electron/blob/main/docs/breaking-changes.md#default-changed-enableremotemodule-defaults-to-false if migrating to larger versions, in particular for electron-store@2 see the following links https://stackoverflow.com/questions/55850616/uncaught-referenceerror-module-is-not-defined-on-delete-module-exports electron/remote#79 https://github.com/electron/remote/blob/main/docs/migration-2.md
After upgrade to remote v2.0.1 (electron v14.0.1) I can't use the remote module in the renderer process.
The line and where the error comes from the renderer file:
Main process:
Everything was working fine before the upgrade.
The text was updated successfully, but these errors were encountered: