electron-builder: TypeError when publishing to Github

  • Version: 3.3.0
  • Target: Mac

I am getting an error when attempting to publish to a Github repo. This is part of the stack trace (let me know if you need more of it):

TypeError: Cannot read property 'url' of null
    at /Users/ben.march/content-manager/node_modules/electron-builder/src/publish/PublishManager.ts:79:8
    at next (native)
From previous event:
    at PublishManager.packager.addAfterPackHandler (/Users/ben.march/content-manager/node_modules/electron-builder/out/publish/PublishManager.js:273:29)
    at default.each.it (/Users/ben.march/content-manager/node_modules/electron-builder/src/packager.ts:376:49)
From previous event:
    at Packager.afterPack (/Users/ben.march/content-manager/node_modules/electron-builder/src/packager.ts:376:28)
    at /Users/ben.march/content-manager/node_modules/electron-builder/src/platformPackager.ts:231:21
    at next (native)
    at tryOnImmediate (timers.js:543:15)
    at processImmediate [as _immediateCallback] (timers.js:523:5)

and here is my publish config:

"build": {
    "asar": false,
    "appId": "org.******.ContentManager",
    "mac": {
      "publish": [{
        "provider": "github",
        "host": "git.*******.org",
        "repo": "*****/content-manager"
      }],
      "category": "public.app-category.utility"
    },
    "dmg": {
      "title": "Content Manager"
    }
  }

I did some debugging and it appears that publishConfigs === [null], so publishConfig === null which is why it is throwing the TypeError.

Thanks, Ben

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

To give you a bit more information:

I created a private repo on hosted GH and used the minimum config "publish": [{"provider": "github"}] and that worked.

Then I added the repository field to package.json and it still worked.

Then I added the “repo” option to the publish config and it still worked.

When I changed the repository field in package.json to the GH Enterprise URL (keeping everything else the same) it threw the error.

When I changed the “repo” option to match the GH Enterprise repo it threw the error.

It looks like the repository field takes precedent over the “repo” option, and it has a hard time parsing the GH Enterprise URL.

Hope this helps.

@benmarch Error is clear. Since you use Github Enterprise, hosted-git-info cannot parse URL. So, you must explicitly set repo and owner options.

"publish": [{
        "provider": "github",
        "host": "git.*******.org",
        "repo": "*****/content-manager"
        "owner": "OWNER"
      }],