nuxt-community / electron-template

Electron starter with nuxt.js
MIT License
251 stars 31 forks source link

How to package this starter-app #1

Closed wushan closed 7 years ago

wushan commented 7 years ago

I am new to electron and I just tried to use electron-packager to make an executable app with electron-packager . Although there isn't any error messages but the app generated is not usable.

How should I do to build this app on desktop ? did I missing any configs ?

Thanks for answering.

This question is available on Nuxt.js community (#c2)
detrohutt commented 7 years ago

What operating system are you using? I'll see if I can get it working and make an example for you to follow.

wushan commented 7 years ago

OS X and thank you ! detrohutt notifications@github.com於 2017年3月17日 週五,上午1:51寫道:

What operating system are you using? I'll see if I can get it working and make an example for you to follow.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/nuxt/electron/issues/1#issuecomment-287139091, or mute the thread https://github.com/notifications/unsubscribe-auth/ADdx3OWCIWgPTGbSD9oKx07_S3qha-zTks5rmXaugaJpZM4MeyGc .

detrohutt commented 7 years ago

Unfortunately I wasn't able to get it working today. :( I'll have to mess around with it some more when I have time. But it's nothing you did wrong, it's just a problem with this project currently.

wushan commented 7 years ago

Any news about this ?

detrohutt commented 7 years ago

I was able to narrow the problem down to a conflict between the Nuxt.render middleware function and Electron. Unfortunately I'm still not able to solve the problem. My Mac OS debugging skills aren't that great.. I've made a reproduction of the issue here in case @Atinux or anyone more familiar with Nuxt.render/Mac debugging has time to take a look. Sorry, I wish I could have been of more help! :/

atinux commented 7 years ago

Ok this is really weird, I can launch the app from the command line:

./electron-example-darwin-x64/electron-example.app/Contents/MacOS/electron-example 

Nuxt is working and the app as well, if I click on the icon, the app quit after 2 seconds, do you have the same problem @wushan ?

wushan commented 7 years ago

Yes, and the problem is that it quit without any error message ....

Sébastien Chopin notifications@github.com 於 2017年3月24日 週五 上午10:08寫道:

Ok this is really weird, I can launch the app from the command line:

./electron-example-darwin-x64/electron-example.app/Contents/MacOS/electron-example

Nuxt is working and the app as well, if I click on the icon, the app quit after 2 seconds, do you have the same problem @wushan https://github.com/wushan ?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/nuxt/electron/issues/1#issuecomment-288913461, or mute the thread https://github.com/notifications/unsubscribe-auth/ADdx3E0mcch3f2wy8Lyfb9KNs4_5YL-Wks5royWlgaJpZM4MeyGc .

atinux commented 7 years ago

Ok I found how to launch the logs:

open ./electron-example-darwin-x64/electron-example.app/Contents/MacOS/electron-example 

I will investigate

detrohutt commented 7 years ago

@Atinux yes I added the 2 second delay to make it obvious what line was causing the crash(see the Readme.md on that branch).. From messing with it before the most I could figure is that electron-packager modifies the environment variables and is leaving out something required by Nuxt.render. But I was never able to see any actual error messages so that is just a guess.

atinux commented 7 years ago

@detrohutt the actual error is:

> No build files found, please run `nuxt build` before launching `nuxt start`

So Nuxt.js cannot launch himself, because I believe the .nuxt folder has not been included by electron-packager

atinux commented 7 years ago

I found the solution, when we launch the application via the icon, process.cwd() used by Nuxt.js to know which directory it has been launched is different.

You can apply the fix by adding this line: https://github.com/nuxt/electron/commit/3f166521b99c77a98d9e70825aa91907f02aa5d7

detrohutt commented 7 years ago

Amazing. Thanks so much for your help. It's embarrassing how much time I spent trying to fix it lol. I guess it helps to know what you're doing. :D

atinux commented 7 years ago

It helps indeed, but I had to look at some issue of electron-packager to be sure, but thanks a lot for making the issue-1-repro branch, it helped me a lot to fix the bug (I never used electron-packager before)!

I updated the master branch to add electron-packager 👍

wushan commented 7 years ago

Thank you all ! Now I am going to play this around. thanks a lot !

Sébastien Chopin notifications@github.com 於 2017年3月24日 週五 上午10:53寫道:

It helps indeed, but I had to look at some issue of electron-packager to be sure, but thanks a lot for making the issue-1-repro branch, it helped me a lot to fix the bug (I never used electron-packager before)!

I updated the master branch to add electron-packager 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nuxt/electron/issues/1#issuecomment-288919504, or mute the thread https://github.com/notifications/unsubscribe-auth/ADdx3PMjLn-5zhHrijShys0Ab0I5hD9Eks5rozAPgaJpZM4MeyGc .