-
Notifications
You must be signed in to change notification settings - Fork 86
isElectronApp is true but remote is null #52
Comments
Okay never mind, I fixed it. Not entirely sure how but I had to downgrade my node typings to 12.0.12. |
It seems that import { Component } from '@angular/core';
import { ElectronService } from 'ngx-electron';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: [ './app.component.scss' ]
})
export class AppComponent {
get window() {
return this.electron.remote.getCurrentWindow();
}
constructor(private electron: ElectronService) { }
close() { this.window.close(); }
} Any reference to |
Try:
Among other things that's one thing I changed, you can also keep your eyes on https://github.com/QuestNetwork/quest-messenger-js - I still have a little libp2p pubsub issue (ipfs/js-ipfs issues/3249), but once that's solved and the demo works, I'll commit it and it has remote working now (using it to require 'fs' so that I can store config, message history, etc) |
I am having undefined issues all over the place with Electron 10.0.0 also. |
I found a solution. In 10+ enableRemoteModule is set to false by default. In your mainWindow constructor, add it to your web preferences
|
So the last thing I told people to try probably did the trick. Thanks for the info @billygerhard ! |
Sometimes it helps to read the release notes! Breaking changes always seem to break stuff! |
That's where I got it. Would be great if these things found their way into the readme since a number of people keep running into the same issue =) |
This worked for me, thank you. :) electron 10.0.0 |
What version of angular are you guys on? I'm having a hell of time connecting to anything electron and was hoping this library would help. Now I get the same thing where the it's going in the block because it's true but the sendSync bombs and is NULL
Do I need to downgrade to electron 10.* ? Even adding the web preferences didn't fix it. EDIT: Currently on |
I have exactly the same problem with Electron 12.0.1 and ngx-electron 2.2.0 |
Its because of the new security options they add as electron gets updated more, my current webPreferences for my main window I know you need on electron 12 are
|
@billygerhard That totally worked! It looks like I was missing the @Jay031 see above. |
Love the quick replies, thanks guys! |
Have struggled with that error for few days too. Basically you can get same behavior and expose only those things you really want to |
So I have tried this with electron v12 - I need to do 3 things: |
With this package.json run find but if try update electron to latest version and not compile. { |
Remote has been deprecated |
I tried the workarounds here: #32
With:
Somehow
nodeIntegration: true
seems to go ignored for me, I'm trying to use the remote module to requirefs
but remote keeps coming back as null. Spent all day trying all different kinds of workarounds, but nothing worked. I have"@angular-builders/custom-webpack": "^9.2.0"
and"electron-builder": "^22.7.0"
:I also tried adding:
It compiles and packages the app but throws
require is not defined
before the app gets loaded, I guess this only worked in an older version of webpack.angular.json has:
"builder": "@angular-builders/custom-webpack:browser",
If I try to
require('electron').remote
orwindow.require('electron').remote
in the console after the unmodified app has loaded (no ngx-electron inside), then I just get require is not defined as well.The text was updated successfully, but these errors were encountered: