aj-techsoul / ELECTRON-4-PHP

An easiest way to use php in electron
MIT License
202 stars 46 forks source link

Love this! When I run npm start it works, but when I package for installation it doesn't... #3

Closed ryanpamplin closed 6 years ago

ryanpamplin commented 6 years ago

Hello. Love this project! I've got it working great when I type npm start on OSX, but when I package it into an app, by moving the files into the app folder within the .app, the app launches the window and says "Not Found - The requested resource /index.php was not found on the server". Any idea what's wrong? Or do you have any directions on how to package into an app properly? Thank you so much!

aj-techsoul commented 6 years ago

@ryanpamplin i think the problem is having because the server is not running or something. Try to run the app and in browser open "localhost:55555" and if there also same thing happening then maybe some other reason

still i will check from my end.

aj-techsoul commented 6 years ago

I checked it and found that server is running but not looking for file on folder and its looking file on Document root is /Users/[username] So i am trying to make it on app folder. Give me some time.

ryanpamplin commented 6 years ago

Thanks so much for figuring that out. I'm really excited to use this!

aj-techsoul commented 6 years ago

Issue fixed. Problem was it was taking the home directory as a Server directory. So i have fixed that but in order to fix it while packaging you need to use --asar=false which i have already made a script for packager. just type

npm run package-mac 

and it will package your mac without asar and also replace the icons with your app icons. before running the above code, you must install package-installer

# for use in npm scripts
npm install electron-packager --save-dev

# for use from cli
npm install electron-packager -g

Thanks @ryanpamplin for showing me this issue. 🥇 :) (Kindly close the issue, if you are satisfied )

ryanpamplin commented 6 years ago

I'm so incredibly satisfied! You've created something that'll be a very good replacement for PHP-Desktop (Windows only) and Nightrain, which hasn't been developed in years. This is exactly what I was looking for and I'm so thrilled to have found it. I think your project will be very popular!

Thank you again, so much!

ryanpamplin commented 6 years ago

One more thing @AJ-TechSoul... I just packaged my app and it works! I did see a warning in the terminal that says "WARNING: asar parameter set to an invalid value (false), ignoring and disabling asar". I searched around and found https://github.com/electron-userland/electron-packager/issues/698. You may want to specify --no-asar instead of --asar=false.

aj-techsoul commented 6 years ago

Thanks @ryanpamplin i will do the changes right now. Thanks again. I am working on making it work on windows and linux also in the way it works on mac. So i will need some time :)