Porting Joplin to FreeBSD

Joplin is an open source alternative to Evernote. It can be used with on-premise backend or with their own cloud storage.
The killer-feature for me is the possibility to use Nextcloud as a backend (only as a backend, without a possibility to edit notes).

The desktop application is Electron based.
After some tweaks I could build and run it with Electron 39.2.7 installed from ports:

joplin-screenshot.jpg


Unfortunately, my experience in JavaScript and Electron is limited, so I'm not able to build the port correctly, with the necessary tweaks correctly integrated. I hope, someone with such experience will create the correct port.
 
Interestingly, "Joplin" is the name of the main town near where I grew up. No relation to the musician Scott Joplin, from whom this app is named. The name alone, and the fact that people have been able to get it running on FreeBSD has piqued my interest, but I have been deterred by the Electron process. Could you share some of your experiences building and installing Electron, and what tweaks you needed to do to get Joplin running?
 
Could you share some of your experiences building and installing Electron, and what tweaks you needed to do to get Joplin running?
Nothing special, just installing Electron from ports, then downloading the last release of Joplin from their Github (sources). Then I was following the procedure that I found here solving the problems with npm packages (OK, I used yarn and not npm as it was the package manager used by Joplin devs). I needed to solve some problems with absent native binaries (I installed them from FreeBSD packages and copied to npm modules dirs). Globally, nothing special, but many manual operations that I cannot replicate inside port build. So, probably, the build system needs some tweaking to avoid these operations.
 
Electron ports require too much patience and power to maintain I think. Electron is such a beast that my machine could build it in over 10 hours and even maybe not. Also I don't know how to include the npm dependencies into the port, I guess you need to have some storage on freebsd.org to host some files. I saw that it has Linux distribution packages like .Deb or tar.xz, maybe a Linux port can be made but not everything is 100% possible as far as I saw.
 
Nothing special, just installing Electron from ports, then downloading the last release of Joplin from their Github (sources). Then I was following the procedure that I found here solving the problems with npm packages (OK, I used yarn and not npm as it was the package manager used by Joplin devs). I needed to solve some problems with absent native binaries (I installed them from FreeBSD packages and copied to npm modules dirs). Globally, nothing special, but many manual operations that I cannot replicate inside port build. So, probably, the build system needs some tweaking to avoid these operations.
I have been trying to get the desktop building on FreeBSD for a while (longer than I would like to admit). I am able to build the server and run on it under FreeBSD. I'd like to make a port of Joplin desktop, CLI, and server. I have never made a port before, but perhaps we could work together on it, or if you could help me to get Joplin building on my system, I would be grateful.

I was looking at the other electron and node apps in the ports tree as a reference. It seems that no two node/electron application ported over were done the same and whatever manual steps you did may already have a solution there.
 
I did get a copy of Joplin running on FreeBSD. However, I do have one issue. I have to use the legacy editor. The non-legacy mode returns the error:
Code:
Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.
in the editor pane. I can reproduce the build by hand and I am working on the patches needed to make a port but I am still figuring out how to build electron and node apps via ports system.
 
I did get a copy of Joplin running on FreeBSD. However, I do have one issue. I have to use the legacy editor. The non-legacy mode returns the error:
Code:
Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.
in the editor pane. I can reproduce the build by hand and I am working on the patches needed to make a port but I am still figuring out how to build electron and node apps via ports system.
Thanks for the update LenR . Really appreciate it 👍
 
I installed Joplin (joplin-desktop-3.5.12_4) from the FreeBSD pkg repository, but when I run it, the CPU spins but there's no app window. Using btop, I can see 4 electron processes are spun up, and have to kill them. Did/does anyone else have this issue? Did you manage to work around it (and how)? Edit: I am on FreeBSD 15.0-RELEASE-p5, node 20.19.6 .(installed with node version manager - nvm). I also have node24 and npm-node24 packages installed, but
Code:
$ which node
shows the nvm-installed version 20.19.6.
 
Sorry, it worked without any issue for me. I didn't have any version of node or electron previously installed, and let
pkg install joplin-desktop do all the installation and configuring.
 
Interesting. When I launch joplin-desktop from the terminal this is the output I get (along with the electron entries in the process listing I mentioned earlier):
Code:
$ joplin-desktop
No such file or directory
Sentry: Initialized with autoUploadCrashDumps: false
(node:78982) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `electron39 --trace-deprecation ...` to show where the warning was created)

I have now followed the instruction to run electron39 with the flag and get the below output:
Code:
$ electron39 --trace-deprecation /usr/local/bin/joplin-desktop&
No such file or directory
App threw an error during load
SyntaxError: Unexpected token 'export'
    at compileSourceTextModule (node:internal/modules/esm/utils:347:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
    at #translate (node:internal/modules/esm/loader:546:20)
    at afterLoad (node:internal/modules/esm/loader:596:29)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:601:12)
    at #createModuleJob (node:internal/modules/esm/loader:624:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:343:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:311:41)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:664:25)
A JavaScript error occurred in the main process
Uncaught Exception:
SyntaxError: Unexpected token 'export'
    at compileSourceTextModule (node:internal/modules/esm/utils:347:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:107:18)
    at #translate (node:internal/modules/esm/loader:546:20)
    at afterLoad (node:internal/modules/esm/loader:596:29)
    at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:601:12)
    at #createModuleJob (node:internal/modules/esm/loader:624:36)
    at #getJobFromResolveResult (node:internal/modules/esm/loader:343:34)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:311:41)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:664:25)
[64795:0331/080809.932591:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[64795:0331/080809.948329:ERROR:dbus/object_proxy.cc:573] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
[64795:0331/080809.948383:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[64795:0331/080809.948396:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[64795:0331/080809.948399:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[64795:0331/080809.948402:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[64795:0331/080809.948405:ERROR:dbus/object_proxy.cc:573] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
 
Back
Top