Closed kolosz closed 6 months ago
So you're running this inside a Docker container, so essentially in linux?
nah, sorry if i made a confusing statement. the laravel app uses docker desktop naturally. but the app itself is installed on macOS. my initial thought was that it might be useful to know if i am using docker desktop or docker engine
update: since version 0.2 the error changed. i installed some missing dependencies and now i have a different issue:
Running as root without --no-sandbox is not supported
so apparently electron has issues with the root user inside the php container.
seems kinda inconvenient. i mean i could add a temp user to run the command but is that a solution, am i missing something here?
@mpociot For what it's worth I was experiencing the same issues using Windows and WSL2 Ubuntu 22.04, but I was able to resolve it by installing the needed dependencies using:
sudo apt install libnss3 libgbm-dev libasound-dev
Although this is appears to get the server started, the command line noted the following errors which I have yet to determine if it causes any additional issues.
Port 5173 is in use, trying another one...
dev server running for the electron renderer process at:
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
start electron app...
[517267:1108/101608.477533:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory
[517267:1108/101608.477683:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory
Error: Command failed: /home/jason/image-defender-desktop/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config
Making sure app folders are available
Skipping Database migration while in development.
You may migrate manually by running: php artisan native:migrate
PHP Server started on port: 8100
[517267:1108/101608.790227:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory
[517267:1108/101609.311546:ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Failed to fetch", source: devtools://devtools/bundled/panels/elements/elements.js (1)
@mpociot For what it's worth I was experiencing the same issues using Windows and WSL2 Ubuntu 22.04, but I was able to resolve it by installing the needed dependencies using:
sudo apt install libnss3 libgbm-dev libasound-dev
Although this is appears to get the server started, the command line noted the following errors which I have yet to determine if it causes any additional issues.
Port 5173 is in use, trying another one... dev server running for the electron renderer process at: ➜ Local: http://localhost:5174/ ➜ Network: use --host to expose start electron app... [517267:1108/101608.477533:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory [517267:1108/101608.477683:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory Error: Command failed: /home/jason/image-defender-desktop/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config Making sure app folders are available Skipping Database migration while in development. You may migrate manually by running: php artisan native:migrate PHP Server started on port: 8100 [517267:1108/101608.790227:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory [517267:1108/101609.311546:ERROR:CONSOLE(1)] "Uncaught (in promise) TypeError: Failed to fetch", source: devtools://devtools/bundled/panels/elements/elements.js (1)
+1
@elegasoft Were you be able to solve that error? I got the same when running php artisan native:serve
from inside a container.
@wajdijurry there is a simliar open issue, also with no responses. seems like an edge case no one is interested in unfortunately
@wajdijurry no I never solved it, I gave up after trying over and over again over sporadically for a couple months. It occurred on both WSL and Ubuntu for me, I just recently engaged a newly released alternative because it's a blocking issue as I can't build it
Building under Docker environments isn't supported at the moment as it introduces various layers of complexity which make debugging issues particularly challenging.
I highly recommend using PHP installed directly on the system - Laravel Herd is a great option for Mac and Windows.
That said, given recent updates, you may have better luck with this now if you update nativephp/electron to v0.6, but I can't guarantee there won't be other dragons hidden there as I haven't tested a Docker setup.
What happened?
Trying to start electron app by using the
php artisan native:serve
command.Response:
/var/www/html/vendor/nativephp/electron/resources/js/node_modules/electron/dist/electron: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
How to reproduce the bug
-> fresh install of a laravel app ->
composer require nativephp/electron
->php artisan native:install
-> Would you like to install the NativePHP NPM dependencies? (yes/no) yes -> Would you like to start the NativePHP development server (yes/no) yesPackage Version
0.1.1
PHP Version
8.2.8
Laravel Version
10.15.0
Node Version
18.17.0
Which operating systems does with happen with?
macOS
Notes
using macOS Ventura 13.4.1 with Docker Desktop the laravel app is running fine