Skip to content

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

@seanaye

Description

@seanaye

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions