question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem building multiple mac targets: TypeError: pattern.startsWith is not a function

See original GitHub issue

Electron Builder:

  • 2.15.3:

Electron 2.0.2

Target:

  • dmg,mas:

I’m running into a problem when I try to build for both dmg,zip and mas.

Basically “target”: [“dmg”, “zip”] // works “target”: [“mas”] // works “target”: [“mas”, “dmg”, “zip”] // shows the error below

Let me know if you need more info…

  TypeError: pattern.startsWith is not a function
    at FileMatcher.normalizePattern (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/fileMatcher.ts:42:17)
    at FileMatcher.patterns.map.it (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/fileMatcher.ts:37:54)
    at Array.map (<anonymous>)
    at new FileMatcher (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/fileMatcher.ts:37:39)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/util/AppFileCopierHelper.ts:123:21
    at Generator.next (<anonymous>)
From previous event:
    at _bluebirdLst.default.mapSeries (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/util/AppFileCopierHelper.ts:120:16)
From previous event:
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/util/AppFileCopierHelper.ts:120:32
    at Generator.next (<anonymous>)
From previous event:
    at copyNodeModules (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/out/util/AppFileCopierHelper.js:319:18)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:261:42
    at Generator.next (<anonymous>)
From previous event:
    at then (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:257:14)
From previous event:
    at _computeFileSets (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:258:10)
    at MacPackager.copyAppFiles (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:280:27)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:214:10
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at MacPackager.doPack (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/platformPackager.ts:162:151)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/macPackager.ts:107:20
    at Generator.next (<anonymous>)
From previous event:
    at MacPackager.pack (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/macPackager.ts:79:95)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:373:24
    at Generator.next (<anonymous>)
    at xfs.stat (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/fs-extra-p/node_modules/fs-extra/lib/mkdirs/mkdirs.js:56:16)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/graceful-fs/polyfills.js:287:18
    at FSReqWrap.oncomplete (fs.js:153:5)
From previous event:
    at Packager.doBuild (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:341:39)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:317:52
    at Generator.next (<anonymous>)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:135:15)
From previous event:
    at Packager._build (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:294:133)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:290:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:794:20)
    at tryOnImmediate (timers.js:752:5)
    at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
    at Packager.build (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/packager.ts:248:14)
    at /Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/Users/paulingalls/src/fanzo/desktop/ripl-electron/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mmaiettacommented, May 9, 2021

Thanks for verifying that @buu700. I’ve approved and merged the PR, it’ll make our next release.

1reaction
mificommented, Mar 26, 2021

Downgrade to v22.10.4 worked for me

Edit: in 22.10.4 it still gives the error, but only if run with DEBUG=electron-builder:

(node:35721) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
  ⨯ pattern.startsWith is not a function  stackTrace=
                                            TypeError: pattern.startsWith is not a function
                                                at FileMatcher.normalizePattern (node_modules/app-builder-lib/src/fileMatcher.ts:58:17)
                                                at node_modules/app-builder-lib/src/fileMatcher.ts:53:54
                                                at Array.map (<anonymous>)
                                                at new FileMatcher (node_modules/app-builder-lib/src/fileMatcher.ts:53:39)
                                                at computeNodeModuleFileSets (node_modules/app-builder-lib/src/util/appFileCopier.ts:197:21)
                                                at node_modules/app-builder-lib/src/platformPackager.ts:306:36
                                                at async Promise.all (index 0)
                                                at AsyncTaskManager.awaitTasks (node_modules/builder-util/src/asyncTaskManager.ts:65:25)
                                                at MacPackager.doPack (node_modules/app-builder-lib/src/platformPackager.ts:219:5)

I get the error when running npx electron-builder --mac. This results in a broken dist/mas build containing only Electron.app, LICENSE and LICENSES.chromium.html, but dist/mac seems to be successfully built.

When instead running npx electron-builder --mac -m dmg it successfully builds without any error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron-userland/electron-builder v22.11.2 on GitHub
... Problem building multiple mac targets: TypeError: pattern.startsWith is not a function (#5739) (a89edcb), closes #3012. Check out latest releases or
Read more >
[Solved] TypeError: startsWith is not a function - ItsJavaScript
The TypeError: startsWith is not a function occurs if we call a startsWith() method on the value that is not of a type...
Read more >
startsWith is not a function getting called for no reason
startsWith (1)) , would occur with a TypeError due to startsWith() requiring a string. We can tell this is a TypeError from the...
Read more >
Puppeteer documentation - DevDocs
Puppeteer is a Node library which provides a high-level API to control Chromium or Chrome over the DevTools Protocol. The Puppeteer API is...
Read more >
Changelog — Python 3.11.1 documentation
On macOS, the libc syslog() function is not thread-safe, so syslog.syslog() ... TypeError was not raised when using more than one TypeVarTuple ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found