我已成功打包我的电子应用程序,安装程序正在执行而不会抛出任何错误 . 当我添加我的松鼠代码以自动更新main.js文件中的电子应用程序时,会出现问题 . main.js文件的代码如下:
if (process.platform === 'darwin') {
autoUpdater.setFeedURL(updateUrl)
autoUpdater.checkForUpdates()
} else {
updateUrl = "http://127.0.0.1/releases/win/"
autoUpdater.setFeedURL(updateUrl)
autoUpdater.checkForUpdates()
}
if (handleSquirrelEvent()) {
return
}
function handleSquirrelEvent() {
if (process.argv.length === 1) {
return false
}
const ChildProcess = require('child_process')
const appFolder = path.resolve(process.execPath, '..')
const rootAtomFolder = path.resolve(appFolder, '..')
const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'))
const exeName = path.basename(process.execPath)
const spawn = function (command, args) {
let spawnedProcess, error
try {
spawnedProcess = ChildProcess.spawn(command, args, { detached: true })
} catch (error) { }
return spawnedProcess
}
const spawnUpdate = function (args) {
return spawn(updateDotExe, args)
}
const squirrelEvent = process.argv[1]
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
spawnUpdate(['--createShortcut', exeName])
setTimeout(app.quit, 50)
return true
case '--squirrel-uninstall':
spawnUpdate(['--removeShortcut', exeName])
setTimeout(app.quit, 50)
return true
case '--squirrel-obsolete':
app.quit()
return true
}
}
上面是我的main.js文件的代码,该文件在我的电子项目中有松鼠部分 . the image contains the error description which I am getting when am launching the