Quasar: Error when building electron: TypeError: bundler is not a function

Created on 8 Oct 2019  路  6Comments  路  Source: quasarframework/quasar

Describe the bug
Electron building has failed, whether it is with packager or builder. And there is no problem with building SPA.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project and build
quasar create <project>
quasar mode add electron
quasar build -m electron

Platform (please complete the following information):
OS: MacOS 14.5
Node: 10.16.3
NPM: 6.11.3
Electron: 5.0.11

Error Stack

  • packager
(node:9563) UnhandledPromiseRejectionWarning:   TypeError: bundler is not a function

  - index.js:115 Promise
    [myproject]/[@quasar]/app/lib/electron/index.js:115:13

  - new Promise

  - index.js:110 Promise.then.then
    [myproject]/[@quasar]/app/lib/electron/index.js:110:14

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7


(node:9563) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9563) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  • builder
(node:11925) UnhandledPromiseRejectionWarning:   TypeError: Cannot read property 'build' of null

  - index.js:119 Promise
    [myproject]/[@quasar]/app/lib/electron/index.js:119:21

  - new Promise

  - index.js:110 Promise.then.then
    [myproject]/[@quasar]/app/lib/electron/index.js:110:14

  - next_tick.js:68 process._tickCallback
    internal/process/next_tick.js:68:7


(node:11925) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:11925) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

And here is the content of [@quasar]/app/lib/electron/index.js

starting from 103 to 136

    }).then(() => {
      const
        bundlerName = cfg.electron.bundler,
        bundlerConfig = cfg.electron[bundlerName],
        bundler = require('./bundler').getBundler(bundlerName),
        pkgName = `electron-${bundlerName}`

      return new Promise((resolve, reject) => {
        log(`Bundling app with electron-${bundlerName}...`)
        log()

        const bundlePromise = bundlerName === 'packager'
          ? bundler({
            ...bundlerConfig,
            electronVersion: getPackageJson('electron').version
          })
          : bundler.build(bundlerConfig)

        bundlePromise
          .then(() => {
            log()
            log(`[SUCCESS] ${pkgName} built the app`)
            log()
            resolve()
          })
          .catch(err => {
            log()
            warn(`鈿狅笍  [FAIL] ${pkgName} could not build`)
            log()
            console.error(err + '\n')
            reject()
          })
      })
    })
bug

Most helpful comment

Are you using npm or yarn to install local packages?

Can you try removing node_modules and do a yarn again?

All 6 comments

Anyone else being able to reproduce this?

Are you using npm or yarn to install local packages?

Can you try removing node_modules and do a yarn again?

Sorry, I somehow solved it by removing node_modules and then reinstall. Thank you anyway.

I ran into this bug as well, just when doing a vanilla quasar app and only installing express. Clearing node_modules and package-lock.json and npm install fixed the problem for me as well. (I was using npm and not yarn).

I ran into this as well with current versions of Quasar. And the solution was the same for me... wipe out node_modules and reinstall seemed to work. Also an NPM user here.

Yarn user .. same solution fixed it.

Was this page helpful?
0 / 5 - 0 ratings