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.

Can't set Electron environmental variables in packaged application without Webpack?

See original GitHub issue

Is it possible to pass ELECTRON_RUN_AS_NODE=true and ELECTRON_NO_ATTACH_CONSOLE=true without setting up Webpack? If so, can someone explain how? I’ve searched all day and tried a bunch of ideas I had, but no luck with any of them.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
MarshallOfSoundcommented, Sep 5, 2018

Setting ELECTRON_RUN_AS_NODE and ELECTRON_NO_ATTACH_CONSOLE in webpack will do absolutely nothing to Electron. Setting them in JS with process.env. ELECTRON_NO_ATTACH_CONSOLE = true in your main process will also do nothing.

Those two environment variables to be set before your app is launched in the initial environment. I.e. you need to set those variables either from your launcher script or your terminal before launching

1reaction
Slapboxcommented, Sep 5, 2018

@MarshallOfSound thank you so much. I searched for a looooong time and couldn’t find a clear explanation which left my somewhat shooting in the dark.

It would be great to add that information in some form here: https://electronjs.org/docs/api/environment-variables

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't set Electron environmental variables in packaged ...
Basically, I've got an application using stdio that works on Mac, but not on Windows. I'm trying to troubleshoot it, but changing to...
Read more >
Environment variable is undefined in electron even it has ...
So I decided to place that value in environment variable and tried to achieve that using webpack. DefinePlugin({}). const Electron = require(" ...
Read more >
Update json file with Environment Variable - Compiling ENV ...
In the Electron App that we develop at our company, there is no Webpack configured for bundling the App, since the App is...
Read more >
Environment Variables - Electron
Certain Electron behaviors are controlled by environment variables because they are initialized earlier than the command line flags and the app's code.
Read more >
Creating an Electron application from scratch
An Electron application is an npm project with the electron package as a dependency. Our first steps will be creating the npm project...
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