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.2k stars 801 forks source link

App doesn't open. Throws an exception everytime #876

Open harryi3t opened 6 years ago

harryi3t commented 6 years ago

I tried downloading the latest app. That also throws an exception. image

Error message

Uncaught Exception:
TypeError: Error processing argument at index 0, conversion failure from #<Object>
    at validateState (/private/var/folders/y7/84_s93tn1gb4pfdqwj1y7rgw0000gn/T/AppTranslocation/3BB54CF6-5E6F-4E28-82B9-E700379554AD/d/laverna.app/Contents/Resources/app/node_modules/electron-window-state/index.js:46:34)
    at module.exports (/private/var/folders/y7/84_s93tn1gb4pfdqwj1y7rgw0000gn/T/AppTranslocation/3BB54CF6-5E6F-4E28-82B9-E700379554AD/d/laverna.app/Contents/Resources/app/node_modules/electron-window-state/index.js:154:3)
    at Object.createWindow (/private/var/folders/y7/84_s93tn1gb4pfdqwj1y7rgw0000gn/T/AppTranslocation/3BB54CF6-5E6F-4E28-82B9-E700379554AD/d/laverna.app/Contents/Resources/app/electron.js:189:22)
    at Object.onReady (/private/var/folders/y7/84_s93tn1gb4pfdqwj1y7rgw0000gn/T/AppTranslocation/3BB54CF6-5E6F-4E28-82B9-E700379554AD/d/laverna.app/Contents/Resources/app/electron.js:147:10)
    at emitTwo (events.js:111:20)
    at App.emit (events.js:191:7)

App code that fails

// electron.js#187
// Recover window state (width, height, and x&y position)
        this.state = windowStateKeeper('main', {
            width  : 1000,
            height : 600
        });

For the time being I have updated the code to

this.state = {x:0, y:0, width: 1000, height: 600};

// And commented out the logic to persist the state

// win.on('close', function() {
//     this.state.saveState(win);
// }.bind(appHelper));

Now atleast I can continue using the app. Please, could you fix the underlying issue, so that I don't need to use this hacky solution. Thanks, great work!

JaykeOps commented 6 years ago

I have exactly the same issue... The day after installed the desktop app it started throwing exceptions on startup.

shanetuohy commented 6 years ago

Same issue here. On Mac. I generally have been using the app in macs 'full screen' mode where it fills an entire desktop if that gives any clue as to what's going on.

The work around above works. On Mac the file is located at /Applications/laverna.app/Contents/Resources/app/electron.js

jcat12345 commented 6 years ago

Help! I'm not a programmer at all. I found Laverna and liked it so transferred all my notes into it, added a password and all was good for a few days. This morning when I fired up my workstation, Laverna threw an error that looks to be the same as above: image

I am on Windows 7 x64. It looks like others were smart enough to do a workaround. However as a non-programmer I don't know what to do.

Can someone help? Or at least tell me how to extract my notes -- so I can move to another tool until this gets fixed?

THANKS

shanetuohy commented 6 years ago

You just need to open the file electron.js in the location mentioned in the error, and comment out the text at line 187 (put // in front of the lines associated with this.state)

Then just copy and paste the code mentioned above, this.state = {x:0, y:0, width: 1000, height: 600}; then save and close the file. Laverna should now start.

jcat12345 commented 6 years ago

Thank you very much for the help!

For any other non-programmers that chance upon this thread: You can open the electron.js file with any text editor. However life is easier if you have one like Notepad++ which shows you the line number, etc. It is free.

In case you make a mistake editing I recommend copying the file so you preserve the original.

Once in the file if you find multiple lines to do with the "Recover window state...", comment all of them out like this: // Recover window state (width, height, and x&y position) // this.state = windowStateKeeper('main', { // width : 1000, // height : 600 //}); Then add a new line like this: this.state = {x:0, y:0, width: 1000, height: 600};

Per the other contributor's comment I also went ahead and commented out the other line, like this: // win.on('close', function() { // this.state.saveState(win); //}.bind(appHelper));

I've got it running again now. Thanks so much!

Djohn12 commented 6 years ago

I came across this error today and laverna wouldn't launch anymore, your trick worked for me on Linux 16.04 \o/

Had some hot stuff I couldn't get my hand on anymore, you just saved my life,

thank you very much

funilrys commented 6 years ago

Hi there, if you use Arch Linux it's patched and published into the AUR package.

If you use other Linux Distribution (an no Ubuntu 16.04 is not Linux 16.04: read more) I published the patch which fix that at https://github.com/Laverna/laverna/issues/913#issuecomment-365572643 or at https://aur.archlinux.org/cgit/aur.git/tree/913.patch?h=laverna if you prefer.

Also, please report to https://github.com/Laverna/laverna/issues/971#issuecomment-411423965 for the state of this project.