capacitor-community / electron

Deploy your Capacitor apps to Linux, Mac, and Windows desktops, with the Electron platform! 🖥️
https://capacitor-community.github.io/electron/
MIT License
318 stars 58 forks source link

App stuck on loading #220

Closed Etchelon closed 1 year ago

Etchelon commented 1 year ago

Describe the bug I simply followed the getting started instructions and the app won't start:

pnpm cap open @capacitor-community/electron results in this:

image

Desktop (please complete the following information):

Additional context My dependencies:

"@capacitor-community/bluetooth-le": "^2.0.1",
"@capacitor-community/electron": "^4.1.2",
"@capacitor-community/sqlite": "^4.2.2",
"@capacitor/action-sheet": "^4.0.1",
"@capacitor/app": "^4.1.0",
"@capacitor/browser": "^4.0.1",
"@capacitor/camera": "^4.1.3",
"@capacitor/core": "^4.4.0",
"@capacitor/device": "^4.0.1",
"@capacitor/dialog": "^4.0.1",
"@capacitor/filesystem": "^4.1.3",
"@capacitor/network": "^4.0.1",
"@capacitor/preferences": "^4.0.1",
"@capacitor/share": "^4.0.1",
"@capacitor/splash-screen": "^4.1.1",
"@capacitor/text-zoom": "^4.0.1",
"@capacitor/toast": "^4.0.1",
"@capacitor/android": "^4.4.0",
"@capacitor/cli": "^4.4.0",
"@capacitor/ios": "^4.4.0",

My capacitor.config.ts:

const config: CapacitorConfig = {
    appId: "io.myorg.myapp",
    appName: "MyApp",
    bundledWebRuntime: false,
    server: {
        url: "http://192.168.1.194:3001",
        cleartext: true,
    },
    webDir: "./dist",
    plugins: {
        CapacitorHttp: {
            enabled: true,
        },
    },
};

I dunno if it has anything to do with the dev server. I'm using Vite and the dev server is correctly configured (I can develop with Android and iOS just fine).

For the moment I just want to know if there's a way to have more logs from the start command... as it is, I have no idea what I could look into.

Etchelon commented 1 year ago

@IT-MikeS sorry to bother. Since, I guess, most maintainers are busy, are there other channels to reach the community and get some help?

jepiqueau commented 1 year ago

@Etchelon if you do cd electron pnpm run electron:start If you look at the console , you will have messages from electron. Good luck

Etchelon commented 1 year ago

@jepiqueau thanks a lot for answering. Looks like sqlite3 is missing:

image

These are the dependencies in package.json inside the electron folder:

  "dependencies": {
    "@capacitor-community/electron": "^4.1.1",
    "@capacitor-community/sqlite": "^4.2.2",
    "chokidar": "~3.5.3",
    "electron-is-dev": "~2.0.0",
    "electron-serve": "~1.1.0",
    "electron-unhandled": "~4.0.1",
    "electron-updater": "~5.0.1",
    "electron-window-state": "~5.0.3"
  },
  "devDependencies": {
    "electron": "^19.0.0",
    "electron-builder": "~22.14.13",
    "electron-rebuild": "^3.2.7",
    "typescript": "~4.3.5"
  },

At some earlier point when running yarn cap sync @capacitor-community/electron the script complained about a missing vite plugin, but it didn't seem like this caused an error and the command completed apparently successfully:

image

Anyway, I added "sqlite3": "^5.1.2" manually to electron's package.json, ran npm i and reran yarn electron:start and now I get an error about a missing VS installation (which I have...):

image

I may be getting there, but in the meantime any ideas?

Etchelon commented 1 year ago

I entered the dark forest of node-gyp + Visual Studio and managed to configure it correctly, so sqlite3 has been rebuilt.

EDIT: ok I found the documentation on your repo on how to make sqlite work in Electron 😅 I should get it to work EDIT2: working ✅ Now I can really fiddle with the Electron app and see if everything works fine (hmr, sqlite, etc)

jepiqueau commented 1 year ago

@Etchelon i am pleased that you find your way and that everything is working