bytenode: Invalid or incompatible cached data (cachedDataRejected) with Vue and Electron
Hi,
I am using Vuejs and Electron using this plugin: https://github.com/nklayman/vue-cli-plugin-electron-builder
I’m trying to protect the electron code using bytenode but I’m running onto the Invalid or incompatible cached data error when running the packaged application.
I have created a basic repository to replicate the error https://github.com/alexsnkr/vue-electron-bytenode
If I run the builder to only generate the package directory I can run electron . from the bundled directory and it runs using the .jsc file just fine, but when I package it for distribution it errors.
I have gone through the issues from people that have ran into the same error, but I’ve had not luck fixing it.
Any help is appreciated,
Thanks.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (1 by maintainers)
const { app, BrowserWindow } = require(‘electron’) function createWindow () { // 创建浏览器窗口 let win = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } })
// 加载index.html文件 win.webContents.openDevTools() win.loadFile(‘index.html’) } app.whenReady().then(createWindow)
const bytenode = require(“bytenode”); // 编译二进制文件 let compiledFilename = bytenode.compileFile({ filename: ‘./test.js’, output: ‘./test.jsc’ // if omitted, it defaults to ‘/path/to/your/file.jsc’ }); require(“./test.jsc”)
window.onload = () => { const div = document.querySelector(“div”);
div.innerText = “哈哈” }
Compile with nodejs. The version of nodejs V8 engine is different from that of electron V8 engine. That’s what happened.
I have solved this problem. You should compile with the same version of electron, not nodejs.
byte_compile is js file.
I believe this is the issue, there must be something in the build process that changes the executable as it works if I run the application in the bundled directory.
Also, I’m only trying to compile the background electron code, not the frontend Vue code.
Thank you for reporting the issue. I will look into it tonight.