fix(stage-tamagotchi): include install-electron in scripts to ensure electron (#2392)
## Description
Let `dev` and `start` scripts run `install-electron` before
`electron-vite`.
Electron 42 removed the `postinstall` script. The `electron` package now
downloads its binary on its `bin` entry's first run. `electron-vite`
reads `node_modules/electron/path.txt` directly, so it never starts that
download. A fresh install therefore fails with:
```
error during start dev server and electron app:
Error: Electron uninstall
at getElectronPath (...)
...
```
`install-electron` runs the same code as the removed `postinstall`
script. It returns immediately when the binary is already present.
This commit is contained in:
@@ -174,6 +174,20 @@ pnpm dev:tamagotchi
|
|||||||
> nr dev:tamagotchi
|
> nr dev:tamagotchi
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> The `dev` and `start` scripts run `install-electron` before `electron-vite`.
|
||||||
|
>
|
||||||
|
> Electron 42 removed the `postinstall` script. The `electron` package now downloads its binary
|
||||||
|
> when you first run its `bin` entry. `electron-vite` reads `node_modules/electron/path.txt`
|
||||||
|
> directly, so it never starts that download. A fresh install therefore fails with
|
||||||
|
> `Error: Electron uninstall`.
|
||||||
|
>
|
||||||
|
> `install-electron` runs the same code as the removed `postinstall` script. It returns
|
||||||
|
> immediately when the binary is already present.
|
||||||
|
>
|
||||||
|
> Remove this step after `electron-vite` supports the lazy download.
|
||||||
|
|
||||||
### Stage Web (Browser version for [airi.moeru.ai](https://airi.moeru.ai))
|
### Stage Web (Browser version for [airi.moeru.ai](https://airi.moeru.ai))
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|||||||
@@ -16,10 +16,10 @@
|
|||||||
"typecheck": "vue-tsc --noEmit",
|
"typecheck": "vue-tsc --noEmit",
|
||||||
"app:dev": "pnpm run dev",
|
"app:dev": "pnpm run dev",
|
||||||
"app:build": "pnpm run build",
|
"app:build": "pnpm run build",
|
||||||
"start": "electron-vite preview",
|
"start": "install-electron && electron-vite preview",
|
||||||
"start:xwayland": "electron-vite preview -- --ozone-platform=x11",
|
"start:xwayland": "install-electron && electron-vite preview -- --ozone-platform=x11",
|
||||||
"dev": "electron-vite dev",
|
"dev": "install-electron && electron-vite dev",
|
||||||
"dev:xwayland": "electron-vite dev -- --ozone-platform=x11",
|
"dev:xwayland": "install-electron && electron-vite dev -- --ozone-platform=x11",
|
||||||
"build": "electron-vite build",
|
"build": "electron-vite build",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"build:unpack": "pnpm run build && electron-builder --dir",
|
"build:unpack": "pnpm run build && electron-builder --dir",
|
||||||
|
|||||||
Reference in New Issue
Block a user