Electron-builder: Cannot Publish to Private GitHub - 404 Not Found - Method undefined url

Created on 22 Mar 2019  路  6Comments  路  Source: electron-userland/electron-builder


  • Version: 20.38.5

  • Target: Windows ia32 and x64


I'm trying to push the project to GitHub releases in a private repository.

The main target is Win ia32 and x64.

I setted the token in the console by

set GH_TOKEN=<blabla>

And at the package.json file:

"publish": {
      "provider": "github",
      "repo": "electron-todo-tasks",
      "owner": "AndreD23",
      "host": "github.com",
      "protocol": "https",
      "releaseType": "draft",
      "token": "<blablabla>",
      "private": true
    }

I'm the only one who will have access to the project, so updating the token in the file apparently not a problem.

But, when I run:

electron-builder --x64 --ia32 --publish always

It shows me the error:

Error: Cannot cleanup:

Error #1 --------------------------------------------------------------------------------
HttpError: 404 Not Found
"method: undefined url: https://github.com/repos/AndreD23/electron-todo-tasks/releases\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"

I'll attach the hole error.

2019-03-22T13_04_27_992Z-debug.log

electron publish error.txt

I tried to change the option always to onTag or onTagOrDraft and change releaseType to release.

I tried to manually create a draft on GitHub first, not works.

I tried to make the repository public for tests, not work too.

I tried to regenerate the token two times and updated at the envs, console and package.json, not works.

There are some configuration that I've missed? What I have to do for the electron publish to GitHub?

At the error, it says that cannot find https://github.com/repos/AndreD23/electron-todo-tasks/releases. Openning it on web browser, it returns 404. I found strange the link, because it adds the word "repos" after github.com, and removing it in the browser it loads fine. This word is setting automatically?

Most helpful comment

Hi @AndreD23

This works for me, on PowerShell type this [Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User") and be sure that you package.json will be like this:

"build": {
    "appId": "com.friasoftit.electron-auto-update",
    "productName": "Electron Auto Update",
    "publish": [
      {
        "provider": "github",
        "owner": "edelCustodio",
        "repo": "electron-auto-update"
      }
    ],
    "win": {
      "publish": [
        "github"
      ],
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ]
    }
  },

And then I run this command yarn run publish and this is how is my publish is on my package.json "publish": "build --win -p always" don't forget to close and open a new PowerShell terminal

All 6 comments

Hi @AndreD23

CC @develar @naheller

Same happens to me, I have 2 days trying to solve this and I have not had luck. the url https://github.com/repos/edelCustodio/electron-auto-update/releases has "repos" word, if I get rid that it works fine on the browser.

Seems like private repo is not well supported by electron-builder, at least this is something that I have read on a few threads https://github.com/electron-userland/electron-builder/issues/2482

Hi @AndreD23

This works for me, on PowerShell type this [Environment]::SetEnvironmentVariable("GH_TOKEN","my-personal-token","User") and be sure that you package.json will be like this:

"build": {
    "appId": "com.friasoftit.electron-auto-update",
    "productName": "Electron Auto Update",
    "publish": [
      {
        "provider": "github",
        "owner": "edelCustodio",
        "repo": "electron-auto-update"
      }
    ],
    "win": {
      "publish": [
        "github"
      ],
      "target": [
        {
          "target": "nsis",
          "arch": [
            "x64",
            "ia32"
          ]
        }
      ]
    }
  },

And then I run this command yarn run publish and this is how is my publish is on my package.json "publish": "build --win -p always" don't forget to close and open a new PowerShell terminal

It Worket!! Thank you so much @edelCustodio!!

Hi @edelCustodio and @AndreD23,

Also as an alternative there is https://www.update.rocks/. It is free for open source project and has been built to work with private github repo.

I am one of the dev behind it. Feel free to contact us for any request.

Thanks for the advice @rllola ! I'll look this alternative.

I've had the same issue as well and the problem is indeed that the automatically generated URL contains /repos/ which breaks the link. Not specifying host as github.com and protocol as https solved the problem.

@maintainers: Is that the intended behavior?

Was this page helpful?
0 / 5 - 0 ratings