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 34 leads to Uncaught Exception when executing app build with electron:build (with solution) #823

Open
Rai-Rai opened this issue Feb 22, 2025 · 0 comments
Labels

Comments

@Rai-Rai
Copy link

Rai-Rai commented Feb 22, 2025

Steps to reproduce

Upgrade to electron 34.2.0 and build the app with npm run electron:build

Java script error occures if the created .exe is started:

Image

✔️ Expected Behavior

Application starts correctly

🔍 Additional context

Problem is caused here:

const url = new URL(path.join('file:', __dirname, pathIndex));

I'm not sure how this ever worked before, but the new URL() is called with .\file:\C:\Users\MyUser\AppData\Local\Temp\2tOTtWToAwGi5zLwSqEL7iitega\resources\app.asar\index.html

My soltution is to replace L41 with:

let joinedPath = path.join(__dirname, pathIndex)
const url = new URL (`file:${path.sep}${path.sep}${joinedPath}`);

And it'll work again. (Tested only on windows)

Problem appears with the upgrade from 33.4.1 to 34.2.0. Other previous verions like 32.3.1, 31.7.7, 30.5.1 worked without a problem.

@Rai-Rai Rai-Rai added the bug label Feb 22, 2025
@Rai-Rai Rai-Rai changed the title Electron 34 leads to Uncaught Exception when executing app build with electron:build Electron 34 leads to Uncaught Exception when executing app build with electron:build (with solution) Feb 22, 2025
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

1 participant