You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编译electron-vite V8字节码时遇‘Electron uninstall’错误求助

问题:添加electron-vite的bytecodePlugin后出现"Electron uninstall"错误

1. 示例仓库复现情况

  • 克隆仓库后执行pnpm i
  • 运行pnpm test:fully时触发错误,未修改任何代码,仅执行上述命令:

vite v4.2.1 building for production...
4 modules transformed.
out/main/bytecode-loader.js 2.28 kB
out/main/foo2-ccaae97d.js 0.20 kB
out/main/index.js 2.40 kB
[vite:bytecode] Electron uninstall
0 bundles compiled into bytecode.
built in 3.21s
error during preview electron app:
Error: Electron uninstall
at Object.getElectronPath (E:\Temp Projects\electron-vite-bytecode-example\node_modules.pnpm\electron-vite@1.0.21_vite@4_55a6a0b3b133fa80ad49095012dd98d5\node_modules\electron-vite\dist\chunks\lib-8ec3e49a.js:60:19)
.....

2. 自有项目情况

  • 基于React-TS的electron-vite项目,原本构建流程正常
  • 为实现V8字节码保护,添加bytecodePlugin后出现相同错误,项目其余功能不受影响
  • 项目配置代码如下:
import { resolve } from 'path'
import { defineConfig, bytecodePlugin, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig({
  main: {
    plugins: [externalizeDepsPlugin(), bytecodePlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        '@renderer': resolve('src/renderer/src')
      }
    },
    plugins: [vue()]
  }
})

内容的提问来源于stack exchange,提问作者SWIK

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 22:06:05