About opening secondary instance in development mode in app-desktop

Hello ,

While trying to open a new window instance in development mode , I get this error

Logger.ts:317 14:02:17: CommandService::execute: openSecondaryAppInstance
index.html:1 Uncaught (in promise) Error: Command failed with ENOENT: /home/my-username/.npm-global/bin/electron /home/my-username/src/joplin/packages/app-desktop --env dev --log-level debug --open-dev-tools --no-welcome --alt-instance-id alt1
spawn /home/my-username/.npm-global/bin/electron ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at processTicksAndRejections (node:internal/process/task_queues:90:21)

When I traced the root cause , I found the origin of this

//app-desktop/bridge.ts


	public appLaunchCommand(env: string, altInstanceId = '') {
		const altInstanceArgs = altInstanceId ? ['--alt-instance-id', altInstanceId] : [];

		if (env === 'dev') {
			// This is convenient to quickly test on dev, but the path needs to be adjusted
			// depending on how things are setup.

			return {
				execPath: `${homedir()}/.npm-global/bin/electron`,
				args: [
					`${homedir()}/src/joplin/packages/app-desktop`,
					'--env', 'dev',
					'--log-level', 'debug',
					'--open-dev-tools',
					'--no-welcome',
				].concat(altInstanceArgs),
			};
		} else {
			return {
				execPath: bridge().electronApp().electronApp().getPath('exe'),
				args: [].concat(altInstanceArgs),
			};
		}
	}


Based on the above error message and this code , it looks like , these assumptions are being made

  1. The source code is cloned into home/src dierctory
  2. Electron is instaled globally in ~/.npm-global

These are not mentioned in BUILD,md file.

The doubt is , is there any reason behind the above 2 assumptions ? because in my case , I cloned the project in a desktop folder and electron is installed globally in /home/my-username/.nvm/versions/node/v24.13.0/bin/electron , because of this , I'm unable to open a new instance.

1 Like

The comment explains why, but what do you want to do? If you want to test this in dev mode, then just change the paths?

1 Like