caoxiemeihao / nuxt-electron

Integrate Nuxt and Electron
MIT License
190 stars 21 forks source link

Nuxt not rendering in the Electron window #94

Open angelhdzdev opened 2 hours ago

angelhdzdev commented 2 hours ago

Hello!

I created a nuxt project with @latest. Then added the nuxt-electron module as I used to do. Didn't work. So because I'm on Linux now not Windows, I went to Electron docs and installed dependencies for Linux.

Now those errors went away and the Electron windows opens, but the Nuxt app is not rendered.

Followed the quick-start example, read the docs again again, went to my old Issues to see if I messed up.

So my latest attempt was matching all the Nuxt deps to your versions, electron, nuxt, vite, vite-plugin-electron, vite-plugin-electron-renderer, electron-builder, and executed pnpm install.

Nuxt keeps not rendering, no Nuxt logo loading animation. Just the empty Electron window.

Attempts to Solve

Nothing.

So to test if Electron is working on my Kubuntu operating system, I created a new Node project, with the index.html and main.js, and installed electron v33, and its working, the HTML is rendered in the Electron window.

So this points to a nuxt-electron module issue or with one of the dependencies (vite-plugin-electron, vite-plugin-electron-rendererer...).

This is my package.json:

{
  "name": "nuxt-app",
  "private": true,
  "main": "dist-electron/main.js",
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev --no-fork",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "postinstall": "nuxt prepare"
  },
  "dependencies": {
    "nuxt": "^3.11.2",
    "vite": "^5.2.8",
    "vue": "latest",
    "vue-router": "latest"
  },
  "devDependencies": {
    "electron-builder": "^24.13.3",
    "nuxt-electron": "^0.7.0",
    "vite-plugin-electron": "^0.28.4",
    "vite-plugin-electron-renderer": "^0.14.5"
  }
}

image image

angelhdzdev commented 2 hours ago

Update

Also noticed that without --no-fork in the dev script, it picks up random port for the nuxt dev server. With --no-fork, it uses localhost:3000 as normal.

The nuxt app works normally when I remove the nuxt-electron module.