Open Lem0nbleach opened 2 months ago
Hi, this bug is due to a mismatch between the Node version and the better_sqlite3 binary:
21:16:07.938 › Error: The module '/nix/store/52jpm7v5fclyj1bxhjhsh016acp0w47n-logseq-0.10.9/share/logseq/resources/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 118. This version of Node.js requires
NODE_MODULE_VERSION 125. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).: logseq_local_/home/cesar/Desktop/test
My guess is that we should either downgrade the Node/Electron version or run npm install
post-install.
This issue is also discussed in upstream: https://github.com/logseq/logseq/issues/10851
Confirmed that using a stable version can be a workaround.
Here is my nix flake code piece:
{ inputs, system, ... }:
{
#Workaround: https://github.com/logseq/logseq/issues/10851
environment.systemPackages =
let
pkgs-stable' = import inputs.nixos-stable {
inherit system;
config = {
permittedInsecurePackages = [
"electron-27.3.11"
];
};
};
in
[
pkgs-stable'.logseq
];
}
but a bugfix is still wanted.
@luochen1990 My workaround is to use the appimage version of Logseq (launch appimage-run ~/Appimage/Logseq-linux-x64-0.10.9.AppImage
at startup and have a keybind for that) which has been working great. I am not really feeling safe to use that version of electron which is the reason why I didn't use the stable version after the update.
But yeah, hopefully they fix the issue soon.
@Lem0nbleach hmmm, So why you think the appimage version is safe ?
@luochen1990 Ashamed to say, because I see no warning when running a appimage 😭 Yeah I didn't realize this before you ask me about it. Apologize for that.
/from upsteam issue discussion/
For those who interested in a short answer: seems like
(logseq.override { electron = pkgs.electron_27; })
is enough for the package to work for now (nixpkgs-unstable).
The stderr output from Logseq includes a few more details than the error box in the Logseq UI:
09:40:36.757 › Error: The module '/nix/store/6may7l5jlg3s3gaj7vy11rliq0q9zcbv-logseq-0.10.9/share/logseq/resources/app/node_modules/better-sqlite3/build/Release/better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 118. This version of Node.js requires
NODE_MODULE_VERSION 128. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).: logseq_local_/home/jeremy/Documents/Logseq
09:40:36.759 › cannot unlink search db: Error: ENOENT: no such file or directory, unlink '/home/jeremy/.config/Logseq/search/logseq_local__home_jeremy_Documents_Logseq'
at Object.unlinkSync (node:fs:1884:11)
at $electron$search$open_db_BANG_$$ (/nix/store/6may7l5jlg3s3gaj7vy11rliq0q9zcbv-logseq-0.10.9/share/logseq/resources/app/electron.js:14542:42)
at $electron$search$get_or_open_db$$ (/nix/store/6may7l5jlg3s3gaj7vy11rliq0q9zcbv-logseq-0.10.9/share/logseq/resources/app/electron.js:14584:3)
at $electron$search$upsert_pages_BANG_$$ (/nix/store/6may7l5jlg3s3gaj7vy11rliq0q9zcbv-logseq-0.10.9/share/logseq/resources/app/electron.js:14588:41)
at /nix/store/6may7l5jlg3s3gaj7vy11rliq0q9zcbv-logseq-0.10.9/share/logseq/resources/app/electron.js:15533:62
So basically the better_sqlite
module needs to run under the specific node version its native functions were compiled against, whereas the default electron package in nixpkgs brings in a different node version.
My gut feeling says this problem would be resolved by actually building Logseq in the derivation instead of unwrapping the AppImage, however when I tried to write a derivation to do that I got build errors I didn't know how to resolve (which has actually been the case every time I've tried to package anything that uses a node runtime)
@quickdudley maybe my idea sounds stupid, but can't we make the wrapper thinner instead? OK, i get that nixpkgs git is cooler than the builtin one, but can't we use the electron package bundled with logseq? Or is it not bundled and i don't understand how appimages work? I got the feeling that everything needed for the app to run is contained in the archive
Describe the bug
Every time I edit something, anything, Logseq would jump an error notification.
Steps To Reproduce
Edit any content in any graph.
Expected behavior
Logseq does not output any error
Screenshots
Notify maintainers
@cheeseecake
Metadata
Add a :+1: reaction to issues you find important.