caoxiemeihao / nuxt-electron

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

Error launching app #31

Closed 171h closed 1 year ago

171h commented 1 year ago

I init a project with the bellow step:

install nuxt and this module

pnpm dlx nuxi@latest init electron-nuxt

pnpm add -D nuxt-electron vite-electron-plugin vite-plugin-electron-renderer electron electron-builder

Add nuxt-electron to the modules section of nuxt.config.ts

export default defineNuxtConfig({
  modules: [
    'nuxt-electron',
  ],
  electron: {
    include: ['electron'],
    outDir: 'dist-electron',
  },
})

Create the electron/main.ts file and type the following code

import { app, BrowserWindow } from 'electron'

app.whenReady().then(() => {
  new BrowserWindow().loadURL(process.env.VITE_DEV_SERVER_URL)
})

Add the main entry to package.json

{
+ "main": "dist-electron/main.js"
}

you can see this reproduction repo https://github.com/171h/test2-electron-nuxt.git

Report bellow error:

Snipaste_2023-05-03_20-18-23

[Window Title]
Error

[Main Instruction]
Error launching app

[Content]
Unable to find Electron app at D:\Python\Project\learnElectron\electron-nuxt

Cannot find module 'D:\Python\Project\learnElectron\electron-nuxt'
Require stack:
- D:\Python\Project\learnElectron\electron-nuxt\node_modules\.pnpm\electron@24.1.3\node_modules\electron\dist\resources\default_app.asar\main.js
- 

[确定]
caoxiemeihao commented 1 year ago

Maybe the 👉 examples/quick-start is better for you :)

171h commented 1 year ago

Maybe the 👉 examples/quick-start is better for you :)

Thanks