Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version mismatch with electron v20 (after setting ELECTRON_CUSTOM_VERSION) #70

Open
seanaye opened this issue Nov 11, 2022 · 0 comments

Comments

@seanaye
Copy link

seanaye commented Nov 11, 2022

Error when launching electron after copying the snapshot file

Version mismatch between V8 binary and snapshot.
V8 binary version: 10.4.132.24-electron.0
Snapshot version: 10.4.132.20-electron.0

yes - I have done ELECTRON_CUSTOM_VERSION=20.3.5 yarn install
OS: MacOS 12.6 (ARM64)

my package json
Screen Shot 2022-11-11 at 3 10 57 PM

resolved to yarn.lock
Screen Shot 2022-11-11 at 3 14 14 PM
Screen Shot 2022-11-11 at 3 14 48 PM

Files successfully copied to app/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Resources

Scripts used to generate the snapshots

Code

const childProcess = require('child_process')
const vm = require('vm')
const path = require('path')
const fs = require('fs')
const electronLink = require('electron-link')

const excludedModules = {}

async function main () {
  const baseDirPath = path.resolve(__dirname, '..')

  console.log('Creating a linked script..')
  const result = await electronLink({
    baseDirPath: baseDirPath,
    mainPath: `${baseDirPath}/src/snapshot/imports.js`,
    cachePath: `${baseDirPath}/cache`,
    shouldExcludeModule: (modulePath) => excludedModules.hasOwnProperty(modulePath)
  })

  const snapshotScriptPath = `${baseDirPath}/cache/snapshot.js`
  fs.writeFileSync(snapshotScriptPath, result.snapshotScript)

  // Verify if we will be able to use this in `mksnapshot`
  vm.runInNewContext(result.snapshotScript, undefined, {filename: snapshotScriptPath, displayErrors: true})

  const outputBlobPath = path.resolve(__dirname, "../cache/")
  console.log(`Generating startup blob in "${outputBlobPath}"`)
  childProcess.execFileSync(
    path.resolve(
      __dirname,
      '..',
      'node_modules',
      '.bin',
      'mksnapshot' + (process.platform === 'win32' ? '.cmd' : '')
    ),
    [snapshotScriptPath, '--output_dir', outputBlobPath]
  )
}

main().catch(err => console.error(err))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant