0

I have cloned the repo, did pnpm i and when i run pnpm test:fully, i get following error,

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\[email protected]_vite@4_55a6a0b3b133fa80ad49095012dd98d5\node_modules\electron-vite\dist\chunks\lib-8ec3e49a.js:60:19) .....

I havent changed anything in code, only just run the commands

Github link https://github.com/alex8088/electron-vite-bytecode-example

I have another electron-vite project based on react-ts. It build perfect, but when i add byteCodePlugin, i get the error. Else every thing work perfect. I m actually trying to do V8 bytecode protection.

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()]
  }
})

1 Answer 1

0

After trying for several times i found out that my nodejs version is latest one v22.16.0 . Since I have both electron "^20.1.4" and electron-vite "1.0.21" older version, i changed them to "^35.5.1" and "3.1.0" .

Then i did :

pnpm install
pnpm approve-builds
pnpm run test:fully

And it worked.

In case issue persists, Use npm instead of pnpm

remove node_modules

pnpm store prune electron
pnpm store prune
npm i electron-vite -D
npm i
npm run test:fully
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.