Debug an electron app

How should I go about debugging this app that gives me Trace/breakpoint trap (core dumped).

default.nix

{
stdenv, 
fetchFromGitHub,
keepBuildTree,
electron,
buildNpmPackage,
}:

buildNpmPackage rec {
	pname = "Caprine";
	version = "2.60.1";
	src = fetchFromGitHub {
		owner = "sindresorhus";
		repo = "caprine";
		rev = "v${version}";
		sha256 = "sha256-y4W295i7FhgJC3SlwSr801fLOGJY1WF136bbkkBUvyw=";
	};
	
	npmDepsHash = "sha256-JHaUc2p+wHsqWtls8xquHK9qnypuCrR0AQMGxcrTsC0=";	
	ELECTRON_SKIP_BINARY_DOWNLOAD = "1";

	nativeBuildInputs = [ keepBuildTree ];

	postBuild = ''
		npm exec electron-builder -- \
		--linux \
		--dir \
		-c.electronDist=${electron}/libexec/electron \
		-c.electronVersion=${electron.version}
	'';
		
}

Going to the build tree an execute the app gives me the core dump, executing it with `electron caprine’ I get:

App threw an error during load
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /nix/store/8pl259qwcrsgvwhw7d1hcawhhsdn6b4d-Caprine-2.60.1/.build/source/dist/linux-arm64-unpacked/caprine
    at new NodeError (node:internal/errors:406:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:100:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:143:36)
    at defaultLoad (node:internal/modules/esm/load:119:20)
    at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:290:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /nix/store/8pl259qwcrsgvwhw7d1hcawhhsdn6b4d-Caprine-2.60.1/.build/source/dist/linux-arm64-unpacked/caprine
    at new NodeError (node:internal/errors:406:5)
    at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:100:9)
    at defaultGetFormat (node:internal/modules/esm/get_format:143:36)
    at defaultLoad (node:internal/modules/esm/load:119:20)
    at ModuleLoader.load (node:internal/modules/esm/loader:396:13)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:56)
    at new ModuleJob (node:internal/modules/esm/module_job:65:26)
    at #createModuleJob (node:internal/modules/esm/loader:290:17)
    at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:248:34)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:229:17)
[71782:0823/135919.794161:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/portal/desktop: org.freedesktop.DBus.Error.InvalidArgs: No such interface “org.freedesktop.portal.FileChooser”
[71782:0823/135919.794877:ERROR:select_file_dialog_linux_portal.cc(290)] Failed to read portal version property
DRI driver not from this Mesa build ('24.2.0-devel' vs '24.0.7')
failed to bind extensions
DRI driver not from this Mesa build ('24.2.0-devel' vs '24.0.7')
failed to bind extensions
DRI driver not from this Mesa build ('24.2.0-devel' vs '24.0.7')
failed to bind extensions

electron-builder debug

Is this supposed to be an ES module?

I am following the build instructions at the bottom of GitHub - sindresorhus/caprine: Elegant Facebook Messenger desktop app. It says built with electron.

Edit: I misunderstood your question, ES doesn’t stand for electron… But I’m not that experienced with js and can’t really answer, because I simply don’t know

This kind of seems like Node.js is asked to execute that file and since the file doesn’t have an extension, Node.js fails to run it.

Sorry for my ignorance, but then how should I go about making this work? Executables in linux don’t have an extension so what is nodejs expecting?

That file is so supposed to be a program, not a module.

Node.js is the executable. It then interprets JavaScript files, which can be ES modules or scripts. It probably figures which is which from their extensions.

I looked at other examples of electron-builder apps and I needed to package it by using wrapProgram. Rookie mistake…