添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm trying to get my Electron Vue.js aplication to update itself when i release a new update in my Github Repro.

I'm packing my app using "electron-builder" and here is my package.json

I was following this guide but it didn't work.

This is the Code for the updater part which is located at the top of the src/main/index.js.

const { app, autoUpdater, dialog } = require('electron')
const server = "https://hazel.scarvite.now.sh/"
const feed = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL(feed)
setInterval(() => {
    autoUpdater.checkForUpdates()
}, 60000)
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
    const dialogOpts = {
        type: 'info',
        buttons: ['Restart', 'Not Now. On next Restart'],
        title: 'Update',
        message: process.platform === 'win32' ? releaseNotes : releaseName,
        detail: 'A New Version has been Downloaded. Restart Now to Complete the Update.'
    dialog.showMessageBox(dialogOpts).then((returnValue) => {
        if (returnValue.response === 0) autoUpdater.quitAndInstall()
autoUpdater.on('error', message => {
    console.error('There was a problem updating the application')
    console.error(message)

I am Hoping that you guys can help me

I can relate, I've spent days getting my auto updater working. Can you include your package.json and the way you package your app e.g. electron-builder or electron-packager. – Joshua Jan 26, 2020 at 23:19 My package.json syntax is different to yours. Try removing the .git at the end of repository.url. Also try changing build.win.publish to an object like: "publish": {"provider": "github"}. Also it doesn't seem like you're using electron-builder to publish your releases, so how do you publish a release on Github? – Joshua Jan 27, 2020 at 23:20 Were packing our app with the npm run build -w, which executes "node .electron-vue/build.js && electron-builder". and it packs it to an exe which we then release it on the repro i linked. if you mean that – ScarVite Jan 28, 2020 at 0:09 Okay, if my package.json syntax suggestions don't work, try releasing the binary on Github with electron-builder's -p option. That'll automatically publish the new release on the Github repo. See docs – Joshua Jan 28, 2020 at 0:12 hi @Meilech, i did not get it to work with hazel, idk if it was a misconfiguration problem, but i just simply did not work. I switched over to github releases for updating and described how i got it to work below – ScarVite Sep 16, 2021 at 12:50

I Figured it out after a bit of an struggle. Turns out the zeit.co server i was using wasn't sending the latest.yml. So We can completely remove

const server = "https://hazel.scarvite.now.sh/"
const feed = `${server}/update/${process.platform}/${app.getVersion()}`
autoUpdater.setFeedURL(feed)

and i started working with github instead. We also had to change the autoupdater from electron, as it is deprecated, to electron-builder's autoupdater instead. We imported it like this: const { autoUpdater } = require("electron-updater"); Don't forget to npm i electron-updater

In my Package.json i changed my build script so it would directly publish to github as a draft.node .electron-vue/build.js && electron-builder -p always.

I also had to add

"repository": {
    "type": "git",
    "url": "https://github.com/ScarVite/Example-Repro/"
    "publish": {
    "provider": "github",
    "releaseType": "release"
"build": {
    "productName": "Your App Name",
    "appId": "com.example.yourapp",
    "directories": {
        "output": "build"
    "files": [
        "dist/electron/**/*"
    "win": {
        "icon": "build/icons/icon.ico",
    "publish": [
            "github"

I called autoUpdater.checkForUpdatesAndNotify(); in my app.on('ready') and set a intervall, so it checks every 10 minutes

Then on the autoupdater event update-downloaded i sent a dialog asking the user if they want to restart and update the app now or later. If the response was now i called autoUpdater.quitAndInstall() and it restarted. the Autoupdater updates the next time you close the app automatically

Hi, I'm able to update my electron app using the above approach but when I go back and open up the electron app, the auto-update pop-up notifies me again... Any suggestions? – santosh kumar Jul 20, 2022 at 5:24 /*Checking updates just after app launch and also notify for the same*/ app.on("ready", function() { autoUpdater.checkForUpdatesAndNotify(); I am using in script object of package.json "dist": "build --win" //for local build "ship": "build --win -p always" //to ship the build for auto update did you check the console log for auto-update? i am not able to see the electron-updater module in dependencies object of package.json Dev-dependecies electron-builder v20.31.0 Dependencies electron-updater v3.1.2 – aniyd Jan 30, 2020 at 8:03 i have "electron-updater": "^4.2.0"in my local package.json and im using node .electron-vue/build.js && electron-builder -p always -w to build. – ScarVite Jan 30, 2020 at 14:00
const server = "https://hazel.scarvite.now.sh/"
const feed = `${server}/update/${process.platform}/${app.getVersion()}` 

output:

https://hazel.scarvite.now.sh//update/${process.platform}/${app.getVersion()}

Make sure you remove the last slash from the feed url.

already tried it, it not working with my hazel link had to do with me not upload latest.yml and the blockmap and there is an issue with zeit.co's service i figured the answer out yesterday – ScarVite Feb 26, 2020 at 19:49

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.