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

Build app does not load properly npm run build #29

Open
CarlosOnline opened this issue Dec 4, 2023 · 4 comments
Open

Build app does not load properly npm run build #29

CarlosOnline opened this issue Dec 4, 2023 · 4 comments

Comments

@CarlosOnline
Copy link

The built app using npm run build does not run properly.

How do I properly package the electron app?

Repro

npm create electron-vite@latest electron-vite-project
cd electron-vite-project
npm install
npm run build
release\0.0.0\win-unpacked\YourAppName.exe

Results:
Empty electron window with no content.
Open Developer Tools to see the error.

From developer tools.

Failed to load resource: net::ERR_FILE_NOT_FOUND index-2fe1d414.js:1
Failed to load resource: net::ERR_FILE_NOT_FOUND index-ad2cb9f4.css:1 
@caoxiemeihao
Copy link
Member

Have many people encountered this problem?

@suraj-sella
Copy link

Did you try to build first?

@CarlosOnline
Copy link
Author

CarlosOnline commented Apr 3, 2024 via email

@lwazi4787
Copy link

what template did you use?

XunJiJiang added a commit to XunJiJiang/create-electron-vite that referenced this issue Jun 26, 2024
…vite#29

The reason why the initial application cannot be built now may be as follows:

(1)remove [workspace-path]\dist-app\win-unpacked\d3dcompiler_47.dll: Access is denied.
This is because the file is occupied by [workspace-path]\dist-app\win-unpacked\[app].exe.
 Just restart the computer or use other methods to unblock it.

(2)C:\Users\[user name]\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code: 1
When this error occurs, the application has completed packaging, but the installation package failed to be packaged.
 This problem occurs when using pnpm, but there is no problem using npm.
After installing Electron-build globally, enter the dist folder and run Electron-build to solve the problem.

(3)Application entry file "main.js" in the "[workspace-path]\dist-app\win-unpacked\resources\app.asar" does not exist. Seems like a wrong configuration.
This is because the copy plug-in does not correctly put main.js and preload.mjs into the dist folder.
Run npm run build again to solve the problem
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

4 participants