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

electron-builder@25 crashes if electron-builder.env exists #8451

Closed
Dozorengel opened this issue Sep 5, 2024 · 5 comments
Closed

electron-builder@25 crashes if electron-builder.env exists #8451

Dozorengel opened this issue Sep 5, 2024 · 5 comments

Comments

@Dozorengel
Copy link

  • Electron-Builder Version: 25.0.0 - 25.0.5
  • Node Version: 20.17.0
  • Electron Version: 31.4.0
  • Electron Type (current, beta, nightly): current
  • Target: mac, windows

If there is electron-builder.env (even empty), any build command throws an error with the following stacktrace:

❯ npx electron-builder
  ⨯ require(...) is not a function  failedTask=build stackTrace=TypeError: require(...) is not a function
    at loadEnv (/Users/dozorengel/projects/glabix-screen-recorder/node_modules/read-config-file/src/main.ts:140:27)

If I delete this file, build is working fine. The latest working version is 24.13.3

@mmaietta
Copy link
Collaborator

mmaietta commented Sep 5, 2024

I'll take a look at this asap. There's other issues appearing with the updated dependency read-config-file, so I may have to just copy the logic directly into electron-builder for more control of the implementation.

Looks like it's failing at this line

require("dotenv-expand")(parsed)

@mmaietta
Copy link
Collaborator

mmaietta commented Sep 9, 2024

Quick note: I've extracted read-config-file into electron-builder, updated dotenv-expand in this PR #8455 and was unable to reproduce the issue, so hopefully that was just a simple fix.

@emeryao
Copy link

emeryao commented Sep 14, 2024

+1 same here

@mmaietta
Copy link
Collaborator

mmaietta commented Sep 14, 2024

This should be fixed in electron-builder 25.1.2, can you please give that a shot?

@emeryao
Copy link

emeryao commented Sep 17, 2024

[email protected] works fine with .env file for my project 👍

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

No branches or pull requests

3 participants