Laverna / laverna

Laverna is a JavaScript note taking application with Markdown editor and encryption support. Consider it like open source alternative to Evernote.
https://laverna.cc/index.html
Mozilla Public License 2.0
9.18k stars 800 forks source link

Laverna won't start #913

Open nachevn opened 6 years ago

nachevn commented 6 years ago

OS: Arch Linux

Error (see screenshot): lavernastarterror

funilrys commented 6 years ago

It's been a really long time since I did not review one of my first package in AUR (a lot of bad practices). Let me first invite you to update Laverna if you installed it from AUR.

I just have a new computer and I installed it from AUR and there's no issue ...

nachevn commented 6 years ago

Thank you @funilrys for the answer. I tried already to reinstall laverna, unfortunately this didn't help at all. Here is the information regarding the installed version of my machine:

yaourt -Qi laverna
Name            : laverna
Version         : 0.7.51-2
Description     : Laverna is a JavaScript note taking application with Markdown
                  editor and encryption support. Consider it like open source
                  alternative to Evernote.
Architecture    : x86_64
URL             : https://laverna.cc/
Licenses        : MPL2
Groups          : None
Provides        : None
Depends On      : gconf
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 129,14 MiB
Packager        : Unknown Packager
Build Date      : Mo 12 Feb 2018 15:05:23 CET
Install Date    : Mo 12 Feb 2018 15:37:47 CET
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None

If I can help with some other information, please just let know.

funilrys commented 6 years ago

@nachevn First and before anything you should avoid yaourt. Please use pacaur instead.

Explanation about why you should avoid yaourt: https://wiki.archlinux.org/index.php/AUR_helpers#Comparison_table

Actually, the current upstream (AUR) version is 0.7.51-3 ...

nachevn commented 6 years ago

Unfortunately same error also with the "newest" version...

pacaur -Qi laverna
Name            : laverna
Version         : 0.7.51-3
Description     : Laverna is a JavaScript note taking application with Markdown editor and encryption support. Consider it like open source alternative to Evernote.
Architecture    : x86_64
URL             : https://laverna.cc/
Licenses        : MPL2
Groups          : None
Provides        : None
Depends On      : gconf
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 131,89 MiB
Packager        : Unknown Packager
Build Date      : Di 13 Feb 2018 10:19:33 CET
Install Date    : Di 13 Feb 2018 10:20:52 CET
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None
funilrys commented 6 years ago

Can you please copy paste the error so I can take a look at it now that we are in the same version ?

nachevn commented 6 years ago
A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Error processing argument at index 0, conversion failure from #<Object>
    at validateState (/usr/share/laverna/resources/app/node_modules/electron-window-state/index.js:46:34)
    at module.exports (/usr/share/laverna/resources/app/node_modules/electron-window-state/index.js:154:3)
    at Object.createWindow (/usr/share/laverna/resources/app/electron.js:189:22)
    at Object.onReady (/usr/share/laverna/resources/app/electron.js:147:10)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:191:7)
funilrys commented 6 years ago

@nachevn Did yoou started it from terminal or laverna.desktop ?

Can you give me the terminal output ?

nachevn commented 6 years ago

@funilrys There is not really terminal output shown, but in comparison with the laverna.desktop way there is a second exception shown:

A JavaScript error occurred in the main process
Uncaught Exception:
Error: listen EADDRINUSE :::9000
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server._listen2 (net.js:1262:14)
    at listen (net.js:1298:10)
    at Server.listen (net.js:1376:9)
    at module.exports (/usr/share/laverna/resources/app/server.js:18:19)
    at Object.startServer (/usr/share/laverna/resources/app/electron.js:154:28)
    at Object.onReady (/usr/share/laverna/resources/app/electron.js:145:10)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:191:7)

After the second dialog is closed, nothing more happend:

$/usr/bin/laverna --dev
Server is running on port: 9000
funilrys commented 6 years ago

Okay @nachevn I wrote a patch but I can't test so you are going to test it 😄

I created a Gist here

Simply run the following and let's see if it's fixed. If it does fix it I'm going to put the patch into the AUR package and report it into this repository.

# wget https://gist.githubusercontent.com/funilrys/da9a94fe7f28fcbe3e49ff33924db91f/raw/8d0438eb0d524ceb5e0086560e3779523ed5d74c/build_script 
# chmod +x build_script
# ./build_script
nachevn commented 6 years ago

@funilrys didn't work. Still the same error

funilrys commented 6 years ago

@nachevn Updated the patch.

# rm -fr test-laverna-patch build_script
# wget https://gist.githubusercontent.com/funilrys/da9a94fe7f28fcbe3e49ff33924db91f/raw/95ec3541660218b466ebfc14eba31c5abd37c509/build_script
# chmod +x build_script
# ./build_script
nachevn commented 6 years ago

@funilrys Thanks, it works. Would you please provide new version in AUR?

funilrys commented 6 years ago

Thanks for feedback @nachevn.

Please uninstall Laverna (pacman -Rnsc laverna) and install the new AUR version which provides the patch (pacaur -S laverna).

funilrys commented 6 years ago

@wwebfor Here's the patch that fixed this.

To apply the following patch please execute

# patch -p0 < pathToThePatch

From the directory which contains electron.js fix this

diff --git electron.js electron.js
index c640036..10a8999 100755
--- electron.js
+++ electron.js
@@ -185,11 +185,13 @@ appHelper = {
      */
     createWindow: function() {

-        // Recover window state (width, height, and x&y position)
-        this.state = windowStateKeeper('main', {
+        // Set window state (width, height, and x&y position)
+        this.state = {
+            x      : 0,
+            y      : 0,
             width  : 1000,
             height : 600
-        });
+        };

         // Create new browser window
         win = new BrowserWindow({
@@ -274,11 +276,6 @@ appHelper = {
      */
     registerEvents: function() {

-        // Save window state (width, height, and x&y position)
-        win.on('close', function() {
-            this.state.saveState(win);
-        }.bind(appHelper));
-
         win.on('closed', function() {
             win = null;
         });
funilrys commented 5 years ago

Hello there, Please report to https://github.com/Laverna/laverna/issues/971#issuecomment-411423965 which explain the state of this project.

For Arch Linux, I think I will create the AUR package once we are fixed with the name of the fork ...

Have a nice day/night, Cheers, Nissar

funilrys commented 5 years ago

@daed if you have time maybe you can implement my patch if it was not already fixed on the dev branch :+1:

daed commented 5 years ago

The dev branch doesn't actually contain an electron.js file in it. It either needed to be rewritten, or it's just more evidence that the project was moving singularly toward a client/server model I guess.

I've patched my local copy of master. I'll test it and push it when I get a chance. Realistically, it's going to be a while before dev is in a good state for release, so it may still be valuable to do maintenance for the time being.