Error when building electron: TypeError: bundler is not a function
See original GitHub issueDescribe 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:
- 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()
})
})
})
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
(node:50952) UnhandledPromiseRejectionWarning ...
Electron Build fails: (node:50952) UnhandledPromiseRejectionWarning: TypeError: bundler is not a function. Help.
Read more >2 - Stack Overflow
Electron.js/Parcel Error: fs.existsSync is not a function ... I am using the Electron/Parcel boilerplate electron-react-parcel-boilerplate which ...
Read more >TypeError: "x" is not a constructor - JavaScript - MDN Web Docs
The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor,...
Read more >Common Configuration - electron-builder
If not specified inside of the build configuration, productName property defined at the top level of package.json is used. If not specified at...
Read more >uncaught typeerror: (0 , react__ ...
The reason you are getting this error is because one of your dependencies (or maybe even your code) relies on React.createContext method. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Are you using npm or yarn to install local packages?
Can you try removing node_modules and do a yarn again?
All I had to do was re-run the build, worked second time.