-
-
Notifications
You must be signed in to change notification settings - Fork 570
Works in dev but errors in prod #3902
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
Comments
hey i am also getting this issue and i am working working on this |
i got a similar issue a 2 days ago & i solved it finally asking gemini with help of yek - https://github.com/bodo-run/yek to upload the entire code. the bug was near in my case i had to change from exact same bug. and this is the exact solution. |
i think your (@damms005) error might be at this line - https://github.com/damms005/electron-forge-help/blob/5f5278bf015cdf796b98d24086c8a082c25ea325/src/main.ts#L12 (just use my exact code was: const isDev = process.env.NODE_ENV === 'development'
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: isDev
? path.join(__dirname, '../preload/preload.js')
: path.join(__dirname, '../preload/preload.js'),
scrollBounce: true,
}, Oh looks like I can remove |
@deadcoder0904 i have tried the fix as suggested by you in my windows os but i am still getting the same error |
@deadcoder0904 this is my code: import { app, BrowserWindow, dialog, ipcMain } from 'electron'; const isDev = process.env.NODE_ENV === 'development'; const createWindow = () => { const mainWindow = new BrowserWindow({ if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { mainWindow.webContents.openDevTools(); app.on('ready', createWindow); app.on('window-all-closed', () => { app.on('activate', () => { ipcMain.handle('ask-and-write-base64', (event, base64: string) => { const destination = join(folder[0], 'sample.png'); return destination; ipcMain.handle('get-file-content-as-base64', (event, filePath: string) => { |
Do u know where actually You should do Also, do asar unpack - https://medium.com/@libaration/decompiling-and-repacking-electron-apps-b9bfbc8390d5 to see where the path is (this is the easiest way to debug it) Its 100% a path issue for the first one. 2nd issue is Also, try asking AI... it'll easily solve this (it did solve for me... specifically Gemini 2.5 Pro Experimental which is free in ai.dev rn) |
@Sandeep-android-2000 bdw, u can just use https://electron-vite.org/guide/#scaffolding-your-first-electron-vite-project instead to not worry about all this. it supports releases too i think - https://electron-vite.org/guide/distribution this might be much easier too. i did face lots of errors many years ago with electron-forge fwiw |
Uh oh!
There was an error while loading. Please reload this page.
Pre-flight checklist
Forge version
7.8.0
Electron version
35.1.2
Operating system
macOs 15.3.2 (24D81)
Last known working Forge version
No response
Expected behavior
When I build my app, it should work like it does in dev
Actual behavior
When I build the app using
electron-forge make
and run the final binary atout/make/electron-forge-help-1.0.0-arm64.dmg
, it errors out on startuo with "Cannot find module 'sharp'":Steps to reproduce
npm start
and confirm it worksnpm run make
and run the executable in./out/make/...
Additional information
It seems #1276 and #1250 have same issues, but they are webpack-based and I am unable to transfer my understanding of them to this vite-based project
The text was updated successfully, but these errors were encountered: