electron-builder: Electron-build has error in building with "Cannot read property 'channel' of null"

I am using Electron builder to build Electron app for Mac. I have built for Window and Linux successfully, but when I tried in building for Mac, I have the following error.

Can not Cleanup: TypeError: Cannot read property 'channel' of null

Electron version 23.1.1 Electron builder version 23.6.0

How to fix this error?

This is my builder config.


{
  "appId": "com.test.testApp",
  "directories": {
    "output": "dist"
  },
  "files": ["build/**/*", "node_modules/**/*", "public/**/*", "electron.js"],
  "publish": {
    "provider": "github"
  },
  "win": {
    "target": "portable"
  },
  "dmg": {
    "title": "${productName} ${version}"
  },
  "linux": {
    "target": ["AppImage", "deb"]
  }
}

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (4 by maintainers)

Most upvoted comments

Please specify ‘repository’ in the package.json

Have you tried resolving this message first?

Looking at the codebase, it’s unable to resolve your publish config. Since it’s github-dependent, I’d recommend fixing the warning first and report back

So the problem happens in my end because I have a GITHUB_TOKEN environment variable in my terminal, and somehow the electron-builder or electron-publisher package assumes that, if I have that, then I want to publish, but rest of publish params are not given so here the inconsistency, some bad check in the library internals and booom.

“Issue closed because it has been stalled for 5 days with no activity”? Wow 😀

I’m also experimenting same issue consistently. By looking at the code is clear that something is calling computeChannelNames() in app-builder-lib/src/publish/updateInfoBuilder.ts by passing null in publishConfig function argument:

function computeChannelNames(packager: PlatformPackager<any>, publishConfig: PublishConfiguration): Array<string> {
  const currentChannel: string = (publishConfig as GenericServerOptions).channel || "latest"

So that line throws because it’s trying to read null.channel. Interesting thing is that TypeScript doesn’t complain in my app.

Tried to run the project locally with open ./dist/mac-arm64/dropbox.app --args --remote-debugging-port=8080 --inspect-brk and I’m seeing this in the logs

(node:30356) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, mkdir 'dropbox-storage'
(Use `dropbox --trace-warnings ...` to show where the warning was created)

I can’t seem to access the remote debugging port, I have ⚠ Remote browser is newer than client browser. in my Inspect and I’m not sure how to resolve that as I’m on latest Chrome AFAICT. About Chrome shows up-to-date 110.0.5481.177 (Official Build) (arm64)

And to confirm, this only occurs on Mac?

Can you put together a minimum reproducible repo of this issue? Such as via an electron boilerplate project?

https://github.com/akachi1409/dropbox-app Invited you.

Can you just leave publish empty instead of explicitly null? That seems like it’d be the same purpose, but null isn’t working obv.