Home / GitHub Page

HELP: Electron App does not open after following Windows building Instructions

After following the instructions for building the Electron Application on Windows, the run.bat command just gets stuck on this and wont continue

175 File(s) copied

> Joplin@1.0.179 compile C:\Users\Runo\Desktop\open-source\joplin\ElectronClient\app
> node compile.js && node compile-package-info.js

Am i missing something?, this is my first time running an Electron App, but not my first time using JavaScript/React, Yarn and Npm

PLEASE I NEED ASSISTANCE , I NEED TO START CONTRIBUTING
Operating System: Windows 10

1 Like

There are various things you could try and that are documented in BUILD.md - https://github.com/laurent22/joplin/blob/master/BUILD.md#troubleshooting-desktop-application

In particular, try to set debugEarlyBugs to true

@laurent i am going through another challenge, when i run npm install in the joplin/ElectronClient/app
directory, i get some weird errors. i have node-gyp installed and alson windows-build-tools installed, but i dont know where these errors are coming from.

heres a part of the error

Running: "C:\Users\Runo\Desktop\open-source\joplin\ElectronClient\app/node_modules/.bin/electron-rebuild.cmd" --arch ia32
Error: Command failed: "C:\Users\Runo\Desktop\open-source\joplin\ElectronClient\app/node_modules/.bin/electron-rebuild.cmd" --arch ia32
- Searching dependency tree
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  unpack_sqlite_dep
  sqlite3.c
  win_delay_load_hook.cc
  sqlite3.vcxproj -> C:\Users\Runo\Desktop\open-source\joplin\ElectronClient\app\node_modules\sqlite3\build\Release\\sqlite3.lib
  backup.cc
  database.cc
  node_sqlite3.cc
  statement.cc
c:\users\runo\.electron-gyp\7.1.9\include\node\v8.h(8513): warning C4996: 'v8::MicrotasksCompletedCallback': was declared deprecated (compiling source file ..\src\statement.cc)c:\users\runo\.electron-gyp\7.1.9\include\node\v8.h(8513): warning C4996: 'v8::MicrotasksCompletedCallback': was declared deprecated (compiling source file ..\src\backup.cc) [C:\Users\Runo\Desktop\open-source\joplin\ElectronClient\app\node_modules\sqlite3\build\node_sqlite3.vcxproj]

  c:\users\runo\.electron-gyp\7.1.9\include\node\v8.h(6918): note: see declaration of 'v8::MicrotasksCompletedCallback' (compiling source file ..\src\statement.cc)c:\users\runo\.electron-gyp\7.1.9\include\node\v8.h(6918): note: see declaration of 'v8::MicrotasksCompletedCallback' (compiling source file ..\src\backup.cc)

this is part if the error log i am getting, please help me get out of this situation

I have no idea about this unfortunately. There’s info about building for Windows here :

1 Like

This section reminded me of this bug report I found on Sqlite’s nodejs repo the other day when I was researching a small bug I helped fix here. The bug affects Windows users only and requires downgrading node to version 12 or installing a VS2015 compiler until the devs finally get it fixed. The part I’m linking is where I ask about the issue and one of their members explains the bug.

2 Likes

I have FIXED this and it successfully built!

@laurent and @bedwardly-down Thanks for reaching out, but unfortunately, this error/challenge that caused my build to fail was because of the code in joplin-test\joplin\ElectronClient\app\electronRebuild.js, which was:

const execCommand = function(command) {
	const exec = require('child_process').exec;

	console.info(`Running: ${command}`);

	return new Promise((resolve, reject) => {
		exec(command, (error, stdout) => {
			if (error) {
				if (error.signal == 'SIGTERM') {
					resolve('Process was killed');
				} else {
					reject(error);
				}
			} else {
				resolve(stdout.trim());
			}
		});
	});
};

const isWindows = () => {
	return process && process.platform === 'win32';
};

async function main() {
	// electron-rebuild --arch ia32 && electron-rebuild --arch x64

	let exePath = `${__dirname}/node_modules/.bin/electron-rebuild`;
	if (isWindows()) exePath += '.cmd';

	if (isWindows()) {
                 // ---------------Where the problem lies ----------------------------------------------//
       	         console.info(await execCommand([`"${exePath}"`, '--arch ia32'].join(' ')));
		console.info(await execCommand([`"${exePath}"`, '--arch x64'].join(' ')));
              // -------------------------------------------------------------------------------------------//
	} else {
		console.info(await execCommand([`"${exePath}"`].join(' ')));
	}
}

main().catch((error) => {
	console.error(error);
	process.exit(1);
});

The code above makes the electron build command to run for both ia32 arch and x64 arch, this is not right, this is what caused my electron-build to fail, because my Windows OS is a x64 arch, it failed because it executed the first command for ia32 arch.

i believe proper way this code should be written is to check for the arch of the windows os, by using process.arch and then deciding which electron-build option should be executed instead of just running the two options that has caused frustration for me.

Taking my advice, i modified the joplin-test\joplin\ElectronClient\app\electronRebuild.js to this and it worked perfectly:

const execCommand = function(command) {
	const exec = require('child_process').exec;

	console.info(`Running: ${command}`);

	return new Promise((resolve, reject) => {
		exec(command, (error, stdout) => {
			if (error) {
				if (error.signal == 'SIGTERM') {
					resolve('Process was killed');
				} else {
					reject(error);
				}
			} else {
				resolve(stdout.trim());
			}
		});
	});
};

const isWindows = () => {
	return process && process.platform === 'win32';
};

async function main() {
	// electron-rebuild --arch ia32 && electron-rebuild --arch x64

	let exePath = `${__dirname}/node_modules/.bin/electron-rebuild`;
	if (isWindows()) exePath += '.cmd';

	if (isWindows()) {
                 // -------------- Solution ----------------------------------------------//
       	     process.arch === 'ia32' ? console.info(await execCommand([`"${exePath}"`, '--arch ia32'].join(' '))) :  console.info(await execCommand([`"${exePath}"`, '--arch x64'].join(' ')));
              // -------------------------------------------------------------------------------------------//
	} else {
		console.info(await execCommand([`"${exePath}"`].join(' ')));
	}
}

main().catch((error) => {
	console.error(error);
	process.exit(1);
});

Please, lets consider this, i believe this is the best approach to modify that code.

i will like to make a pull request after your review, cheers

I wonder if there was a compatibility reason for supporting ia32 only. I know quite a few apps are still 32 bit for that reason on Windows. Either way, you’re quite welcome. If this is accepted, that would be so cool.

1 Like