Skip to content
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

NODE_ENV variables showing as undefined in packaged application #632

Closed
Mercieral opened this issue Aug 2, 2016 · 4 comments
Closed

NODE_ENV variables showing as undefined in packaged application #632

Mercieral opened this issue Aug 2, 2016 · 4 comments
Labels

Comments

@Mercieral
Copy link

  • Version: 5.20.0
  • Target: Mac

I originally was setting the NODE_ENV variables through the build script...
"packageALL": "NODE_ENV=production grunt build_production_electron && build -mwl",
and that seemed to be working properly about 2 weeks ago. But now I am just getting NODE_ENV=undefined whenever I call process.env.NODE_ENV in the packaged application (but not when run using electron-prebuilt). Did something happen to how node environment variables are set in the packaged application, or is there a better way to set the NODE_ENV variable?

@develar
Copy link
Member

develar commented Aug 2, 2016

NODE_ENV is a just env var, it is not set to packaged app.

I am just getting NODE_ENV=undefined whenever I call process.env.NODE_ENV in the packaged application (but not when run using electron-prebuilt)

So, it means that no NODE_ENV in your env. NODE_ENV=production during build only set env during build, not for production app.

Use --extraMetadata param (5.22.1+). e.g. build --em.foo=bar and then read your package.json (see #494)

@Mercieral
Copy link
Author

@develar

Thanks, I thought it was working earlier but I was probably just fooling myself 😆. I will try using extraMetadata

@develar
Copy link
Member

develar commented Aug 2, 2016

Please note — extraMetadata only for ASAR.

@ganeshrvel
Copy link

@Mercieral how did you solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants