question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Configurable Default Electron Port

See original GitHub issue

In many environments developers are not permitted to find available port. We must use specified ports allotted. Can we change the main.js file to include the following (~ line 66):

    let defaultElectronPort = 8000;
    if (manifestJsonFile.electronPort) {
        defaultElectronPort = (manifestJsonFile.aspCoreBackendPort)
    } 
    // hostname needs to belocalhost, otherwise Windows Firewall will be triggered.
    portscanner.findAPortNotInUse(defaultElectronPort, 65535, 'localhost', function (error, port) {
        console.log('Electron Socket IO Port: ' + port);
        startSocketApiBridge(port);
    });

This will allow users to explicitly set the port just as you can do with the aspNetCore port.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
aarong-avcommented, Nov 11, 2020

I put in the PR. Let me know if it is wrong.

0reactions
aarong-avcommented, Nov 11, 2020

Is there some guidance on the electron.manifest.json “files” section? I think I can work around this problem by making my own main.js but I can’t find any docs on how it works and copying an example ElectronHostHook does seem to overwrite the main.js.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change electron-forge default port? - node.js
I just started out using electron-forge and ran into the same issue, and it seemed like the electron/webpack was ignoring my devServer.port ......
Read more >
How to change electron forge's renderer port
I just started using electron-forge and I stumbled across a problem : when trying to change the renderer's port (that runs by default...
Read more >
[Solved]-How to change electron-forge default port?-Reactjs
I just started out using electron-forge and ran into the same issue, and it seemed like the electron/webpack was ignoring my devServer.port value....
Read more >
Common Configuration
Defaults to version of electron , electron-prebuilt or electron-prebuilt-compile dependency. extends Array<String> | String | “undefined” - The name of a built ...
Read more >
Debugging the Main Process
The default port is 5858 . electron --inspect=5858 your/app ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found