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

Nextron with Electron v22.0.0 or newer show only white page #384

Closed
noevermaurice opened this issue Jul 16, 2023 · 15 comments
Closed

Nextron with Electron v22.0.0 or newer show only white page #384

noevermaurice opened this issue Jul 16, 2023 · 15 comments

Comments

@noevermaurice
Copy link

Description:
When using Nextron along with Next.js in version 13.3.3 and Electron in version 22.0.0, an issue occurs where the application displays a white screen upon start and fails to load the expected content. No error messages or warnings are displayed to indicate the problem.

Steps to Reproduce:

Use Nextron with Next.js in version 13.3.3 and Electron in version 22.0.0.
Start the application.
Expected Behavior:
The application should successfully start and display the expected content.

Current Behavior:
The application starts but only shows a white screen, failing to load the expected content.

Additional Information:

This issue occurs when using Nextron, Next.js in version 13.3.3, and Electron in version 22.0.0 together.
No error messages or warnings are shown to indicate the problem.
Other features of the application may function correctly, but the main content is not displayed.

@noevermaurice noevermaurice changed the title Nextron with Electron v22.0.0 Nextron with Electron v22.0.0 show only white page Jul 16, 2023
@noevermaurice noevermaurice changed the title Nextron with Electron v22.0.0 show only white page Nextron with Electron v22.0.0 or newer show only white page Jul 16, 2023
@eliasiturri
Copy link

I had the same issue. This line on the terminal

(node:77265) UnhandledPromiseRejectionWarning: Error: ERR_INVALID_URL (-300) loading 'http://localhost:./home'

led me to look for the missing port variable.
As a temporary fix, you can locate the line

const port = process.argv[2];

in the file background.js

and replace it with

const port = 8888;

or whatever the port you are using for development is.

I'm not sure where the process arguments are taken from, but this can probably be solved by just modifying the command used to call electron or next or something.

Hope this helps you continue development

@AbdeenM
Copy link

AbdeenM commented Jul 19, 2023

Same problem as OP, can confirm same problem is occurring for any Next v13.x and Electron v22+.
No errors or any logs from my end though

@noevermaurice
Copy link
Author

thank you for trying to help i got this error

❯ yarn dev
yarn run v1.22.19
warning ../package.json: No license field
$ nextron

DevTools listening on ws://127.0.0.1:5858/devtools/browser/d430a5c1-f4e3-4607-8d01-a3c165360dd1

  • event compiled client and server successfully in 150 ms (18 modules)
  • wait compiling...
  • event compiled client and server successfully in 90 ms (18 modules)
  • wait compiling /home (client and server)...
  • event compiled client and server successfully in 702 ms (247 modules)
  • wait compiling...
  • event compiled client and server successfully in 118 ms (247 modules)
    OrSJdX9KOfvFJ0sXIXj0
    [57150:0722/201130.537269:ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Failed to fetch", source: devtools://devtools/bundled/panels/elements/elements.js (1)

@hockyy
Copy link

hockyy commented Jul 24, 2023

Everyone is having the same issue: #346 (comment)

@uzunhair
Copy link

uzunhair commented Aug 23, 2023

Первый шаг, Вы должны поправить настройки и включить в webPreferences
nodeIntegration: false,
contextIsolation: true,
enableBlinkFeatures: '',
То есть должно получиться так
image

Далее вы должны найти другие проблемы.
В моем случае была проблема в /renderer/next.config.js
Вы должны либо удалить целиком файл либо закомментировать следующие строки
image

@eastrd
Copy link

eastrd commented Sep 9, 2023

Hello, any updates on this issue?

@uzunhair
Copy link

Hello, any updates on this issue?

I wrote an answer to your question, look at my comment on the above

@makeusabrew
Copy link

Upgrading Electron to latest (26.2.2 at the time of writing) seems to work okay for me in dev and production, with the caveat being that I was already using nodeIntegration: false and contextIsolation: true (per Electron recommendations and best practices). I don't speak Russian but I'm pretty sure that's what @uzunhair was indicating in his comments earlier in this thread!

@saltyshiomix
Copy link
Owner

@makeusabrew
Thank you for trying it!
I confirmed it works fine by removing config.target = 'electron-renderer' in next.config.js 💯
(v22 - v26 are OK!)

@noevermaurice and everyone,
Feel free to reopen the issue if any troubles :)

@MaxLiebsch
Copy link

Dear, the problem persist for me.

I confirmed it works fine by removing config.target = 'electron-renderer' in next.config.js 💯

That does not work, if nodeIntegration: true and contextIsolation: false

@saltyshiomix
Copy link
Owner

@MaxLiebsch

Could you let me know, are you using IPC? (ipcMain and ipcRenderer)

@MaxLiebsch
Copy link

MaxLiebsch commented Oct 3, 2023

Dear @saltyshiomix,
thanks that you taking time to reply.

We use nextron in two production applications.

We are importing ipcRenderer in the renderer process, so removing config.target results in missing dependencies for fs.

Any updates?

@rinalditomas
Copy link

rinalditomas commented Nov 3, 2023

I'm facing the same issue. Initially, I encountered problems when attempting to build for Windows, prompting me to upgrade Electron to the current version, 27.0.0.

After upgrading Electron, the build process worked well, but I'm now encountering a blank page issue when running the application in dev mode. I've experimented with different configurations, such as disabling nodeIntegration and enabling contextIsolation. However, these changes resulted in a frontend error: "Uncaught ReferenceError: global is not defined." Additionally, when I removed config.target = 'electron-renderer', I encountered another error: "Module not found: Can't resolve 'fs'."

I also attempted to resolve this by downgrading to version 26.2.2 and follow the previously mentioned steps, but unfortunately, the issue persisted. Are there any updates or solutions available for this problem?

My versions:

   "electron": "27.0.0",
   "electron-builder": "^23.3.3",
   "next": "^12.2.5",
    "nextron": "^8.12.0",

@openarun
Copy link

Related to #346 and not fixed.

@hockyy
Copy link

hockyy commented Aug 16, 2024

just slowly port your app. You can achieve the same functionalities with nodeIntegration false and contextIsolation true

I ported my nextron v8 to v9, electron 21 to 31, next 13 to 14, it takes some times, but its not impossible.

hockyy/miteiru#60

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