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.

Upon running `electron-forge make` on target `dmg` TypeError: Cannot read property 'call' of undefined

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue: After successfully packaging, and testing my app, I run electron-forge make for target dmg and I get the error found below. My question is, are these commonly errors in my own code-base or is this something with electron package?

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

Packaging Electron project.
  electron-forge:lifecycle Process Started: Preparing to Package Application for arch: x64 +0ms
  electron-forge:project-resolver searching for project in: /Users/joshua/Projects/my-electron-app/tmp/package_task-tmp_path-H3Df5Eqo.tmp +1ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/joshua/Projects/my-electron-app/tmp/package_task-tmp_path-H3Df5Eqo.tmp/package.json +3ms
  electron-forge:hook could not find hook: generateAssets +10ms
  electron-forge:hook could not find hook: prePackage +1ms
  electron-forge:packager packaging with options { asar: false,
  overwrite: true,
  name: 'My App',
  appCopyright: 'Copyright (c) 2017 My App',
  versionString: 
   { CompanyName: 'My Company',
     FileDescription: 'My App',
     ProductName: 'My App',
     InternalName: 'My App' },
  protocols: [ { name: 'My App Universal', schemes: [Object] } ],
  protocol: [ 'whatever' ],
  protocolName: 'My App Universal',
  icon: 'assets/icons/my-app',
  afterCopy: [ [Function], [Function], [Function], [Function] ],
  afterExtract: [],
  dir: '/Users/joshua/Projects/my-electron-app/tmp/package_task-tmp_path-H3Df5Eqo.tmp',
  arch: 'x64',
  platform: 'darwin',
  out: 'electron-out',
  electronVersion: '1.6.8',
  quiet: true } +0ms
  electron-forge:lifecycle Process Succeeded: Preparing to Package Application for arch: x64 +3s
  electron-forge:lifecycle Process Started: Compiling Application +1ms
  electron-forge:lifecycle Process Succeeded: Compiling Application +2s
  electron-forge:lifecycle Process Started: Preparing native dependencies +1ms
  electron-forge:lifecycle Process Succeeded: Preparing native dependencies +27ms
  electron-forge:lifecycle Process Started: Packaging Application +0ms
  electron-forge:hook could not find hook: postPackage +948ms
  electron-forge:lifecycle Process Succeeded: Packaging Application +0ms
Making Electron project.
  electron-forge:project-resolver searching for project in: /Users/joshua/Projects/my-electron-app +254ms
  electron-forge:project-resolver electron-forge compatible package.json found in /Users/joshua/Projects/my-electron-app/package.json +1ms
  electron-forge:require-search searching [ '../makers/darwin/dmg.js',
  '../makers/generic/dmg.js',
  'electron-forge-maker-dmg',
  'dmg',
  '/Users/joshua/Projects/my-electron-app/dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/makers/darwin/dmg.js',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/makers/generic/dmg.js',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/electron-forge-maker-dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/dmg',
  '/Users/joshua/Projects/my-electron-app/dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/makers/darwin/dmg.js',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/makers/generic/dmg.js',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/node_modules/electron-forge-maker-dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/node_modules/dmg',
  '/Users/joshua/Projects/my-electron-app/dmg',
  '/Users/joshua/Projects/my-electron-app/node_modules/dmg' ] relative to /Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api +8ms
  electron-forge:require-search testing ../makers/darwin/dmg.js +1ms
  electron-forge:hook could not find hook: preMake +4ms
Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
    at CpFileError.get (/Users/joshua/Projects/my-electron-app/node_modules/nested-error-stacks/index.js:22:51)
    at _callee2$ (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/dist/api/make.js:376:94)
    at tryCatch (/Users/joshua/Projects/my-electron-app/node_modules/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (/Users/joshua/Projects/my-electron-app/node_modules/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as throw] (/Users/joshua/Projects/my-electron-app/node_modules/regenerator-runtime/runtime.js:117:21)
    at Generator.tryCatcher (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/util.js:16:23)
    at PromiseSpawn._promiseRejected (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/generators.js:107:10)
    at Promise._settlePromise (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:576:26)
    at Promise._settlePromise0 (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/Users/joshua/Projects/my-electron-app/node_modules/electron-forge/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)

What command line arguments are you passing?

electron-forge make

What does your config.forge data in package.json look like?

	"config": {
		"forge": "./ember-electron/electron-forge-config.js"
	}
const path = require("path");

function getSigningCert() {
	if (process.platform !== "win32") {
		return;
	}

	if (process.env.CODESIGN_CERTIFICATE) {
		return process.env.CODESIGN_CERTIFICATE;
	} else {
		console.log("Codesigning certificate can not be found, release build will fail");
		console.log("To fix, set CODESIGN_CERTIFICATE");
	}
}

function getSigningPassword() {
	if (process.platform !== "win32") {
		return;
	}

	if (process.env.CODESIGN_PASSWORD) {
		return process.env.CODESIGN_PASSWORD;
	} else {
		console.log("Codesigning password can not be found, release build will fail");
		console.log("To fix, set CODESIGN_PASSWORD");
	}
}
module.exports = {
	"make_targets": {
		"win32": [
			"squirrel",
			"appx",
			"zip"
		],
		"darwin": [
			"dmg",
			// "zip"
		],
		// "linux": [
		//   "deb",
		//   "rpm"
		// ]
	},
	"electronPackagerConfig": {
		name: "MyApp",
		appCopyright: "Copyright (c) 2017 MyApp",
		versionString: {
			CompanyName: "Me",
			FileDescription: "MyApp",
			ProductName: "MyApp",
			InternalName: "MyApp"
		},
		protocols: [{
			name: "MyApp Universal",
			schemes: ["my-app"]
		}],
		protocol: ["my-app"],
		protocolName: "MyApp Universal",
		overwrite: true,
		icon: "assets/icons/my-app"
	},
	"electronInstallerDMG": {
		title: "MyApp",
		background: "assets/dmg/installer_background.png",
		icon: "assets/icons/my-app.icns",
		iconsize: 100,
		window: {
			size: {
				width: 600,
				height: 571
			}
		}
	},
	"electronWinstallerConfig": {
		name: "MyApp",
		icon: "assets/icons/my-app",
		noMsi: true,
		authors: "Me",
		exe: "MyApp.exe",
		// iconUrl: ``,
		setupIcon: path.join(__dirname, "../../../assets/icons/my-app.ico"),
		title: "MyApp",
		loadingGif: path.join(__dirname, "../../../assets/win/installer-dev.gif"),
		// certificateFile: getSigningCert(),
		// certificatePassword: getSigningPassword()
	},
	"electronInstallerRedhat": {},
	"windowsStoreConfig": {
		// containerVirtualization: false,
		// inputDirectory: 'C:\\input\\',
		// outputDirectory: 'C:\\output\\',
		// flatten: false,
		// packageVersion: '1.0.0.0',
		packageName: "MyApp",
		packageDisplayName: "MyApp",
		packageDescription: "MyApp",
		packageExecutable: "app/MyApp.exe"
		// assets: 'C:\\assets\\',
		// manifest: 'C:\\AppXManifest.xml',
		// deploy: false,
		// publisher: 'CN=developmentca',
		// windowsKit: 'C:\\windowskit',
		// devCert: 'C:\\devcert.pfx',
		// desktopConverter: 'C:\\desktop-converter-tools',
		// expanedBaseImage: 'C:\\base-image.wim',
		// makeappxParams: ['/l'],
		// signtoolParams: ['/p'],
		// makePri: true,
		// createConfigParams: ['/a'],
		// createPriParams: ['/b']
	}
};

};

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
MarshallOfSoundcommented, May 25, 2017

Yeah, that was what I was inferring this edit 👍

EDIT: Of note in the stack trace it looks like a promise was rejected _promiseRejected and from a cursory inspection of the transpiled code the .call is pushing the error onto the promise context (not our code).

Looks like a bug in one of our babel transpilers, I will try to repro and follow up with them but async/await transpilation might be beyond me 😆

1reaction
jfruxcommented, May 25, 2017

When I fixed the paths, it works now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upon running `electron-forge make` on target `dmg` TypeError ...
Upon running `electron-forge make` on target `dmg` TypeError: Cannot read property 'call' of undefined · Issue #236 · electron/forge · GitHub.
Read more >
Electron Forge Error - cannot read property 'close' of undefined
I just ran into this today and managed to find a hint here. You have to bind to the Electron app 's window-all-closed...
Read more >
electron - Atom Discussion - RSSing.com
I have been facing issues with “TypeError: Cannot read property **** of undefined” while using sessions and dialogs. I believe the issue flows...
Read more >
How to Package Your Multi-platform Electron App
To distribute your app with Electron, you need to package it for each operating system you want to target. The goal is to...
Read more >
All of the Documentation | Electron - GitHub Pages
A Boolean that is set to true after the child window gets closed. BrowserWindow. Create and control browser windows. Process: Main. // In...
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