Repository navigation
Description
What were you trying to do?
Trying to run the default install of NativePHP.
What happened?
I installed NativePHP into a new Laravel app and followed the instructions to build the app.
When I try to run the app, I get the following:
Unzipping PHP binary from /home/rng/work/NativePhp/vendor/nativephp/php-bin/bin/linux/x64/php-8.4.zip to /home/rng/work/NativePhp/vendor/nativephp/desktop/resources/build/php
Copied PHP binary to /home/rng/work/NativePhp/vendor/nativephp/desktop/resources/build/php/php
renderer and preload config is missing
vite v7.1.6 building SSR bundle for development...
watching for file changes...
build started...
✓ 37 modules transformed.
node:internal/fs/watchers:254
const error = new UVException({
^
Error: EMFILE: too many open files, watch '/home/rng/work/NativePhp/app/Providers/NativeAppServiceProvider.php'
at FSWatcher.<computed> (node:internal/fs/watchers:254:19)
at Object.watch (node:fs:2549:36)
at createFsWatchInstance (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:6957:16)
at setFsWatchListener (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:7004:16)
at NodeFsHandler._watchWithNodeFs (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:7159:15)
at NodeFsHandler._handleFile (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:7223:24)
at NodeFsHandler._addToNodeFs (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:7465:22)
at async file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:8477:22
at async Promise.all (index 0)
Emitted 'error' event on FSWatcher instance at:
at FSWatcher._handleError (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:8673:11)
at NodeFsHandler._addToNodeFs (file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:7473:19)
at async file:///home/rng/work/NativePhp/vendor/nativephp/desktop/resources/electron/node_modules/rollup/dist/es/shared/watch.js:8477:22
at async Promise.all (index 0) {
errno: -24,
syscall: 'watch',
code: 'EMFILE',
path: '/home/rng/work/NativePhp/app/Providers/NativeAppServiceProvider.php',
filename: '/home/rng/work/NativePhp/app/Providers/NativeAppServiceProvider.php'
}
I should note that I have generously increased my system limits to try to work around this but the issue persists:
~/work/NativePhp$ ulimit -n
65536
~/work/NativePhp$ cat /proc/sys/fs/inotify/max_user_watches
4097152
For reference, here is my composer.json require section:
"require": {
"php": "^8.2",
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10.1",
"laravel/wayfinder": "^0.1.11",
"nativephp/desktop": "^2.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"pestphp/pest": "^4.1",
"pestphp/pest-plugin-laravel": "^4.0"
},
but the issue persists. Even if we're watching /vendor and /node_modules (I don't think we should, maybe they can be excluded), I think this error is a sign of something weird going on.
How to reproduce the bug
See above.
Debug Output
{
"Environment": {
"PHP": {
"Version": "8.4.5",
"Path": "/usr/bin/php8.4"
},
"Laravel": {
"Version": "12.35.1",
"ConfigCached": false,
"RoutesCached": false,
"DebugEnabled": true
},
"Node": {
"Version": "v22.21.0",
"Path": "/usr/bin/node"
},
"NPM": {
"Version": "10.9.4",
"Path": "/usr/bin/npm"
},
"OperatingSystem": "Linux"
},
"NativePHP": {
"Versions": {
"nativephp/desktop": "2.0.1.0",
"nativephp/php-bin": "1.1.1.0"
},
"Configuration": {
"Provider": "App\Providers\NativeAppServiceProvider",
"BuildHooks": {
"Pre": [],
"Post": []
},
"NotarizationEnabled": false,
"AzureTrustedSigningEnabled": false,
"CustomPHPBinary": false
}
}
}
Which operating systems have you seen this occur on?
KUbuntu 25.04
Notes
Please note that I'm not sure that this is a bug or some kind of weird setup issue. Feel free to reclassify.
Activity
gwleuverink commentedon Oct 28, 2025
Hi @rgasch. Thanks for your detailed report.
Going by the errors it seems like this might be related to this line here:
desktop/resources/electron/electron.vite.config.mjs
Line 12 in d5b6179
It instructs vite to watch your service provider & reload when anything changes. Can you confirm that's the issue by removing that line?
robertgdev commentedon Oct 28, 2025
Yes, when commenting out this line, the system starts.
I'll leave this issue open so you can decide if it warrants a patch from your side; please feel free to close it when you think it's appropriate.
Thank you for your help!
gwleuverink commentedon Oct 28, 2025
Dubious. What's passed to that function is just a path to a single file. But the error suggests it's hitting the file open limit, which I agree is weird.
It's using the
electron-vite dev --watchcommand under the hood while runningnative:run. It almost seems like vite is using a different watching strategy for the entire project altogether when passing a single outside file to watch.I wonder what files are actually being watched in both scenarios (with the offending line present/commented out)
Could you run
strace -e inotify_add_watch -p $(pgrep -f vite)robertgdev commentedon Oct 29, 2025
If I do
and then
I get an error:
Am I doing this right?
gwleuverink commentedon Oct 29, 2025
Hmm perhaps it needs to be electron-vite instead? I’m not sure, I’m not on Linux so can’t verify
robertgdev commentedon Oct 29, 2025
I'm a little doubtful the command you gave is correct. I did the following:
Using your script, I get an error. But if I do
it works (in the sense that it attaches to the process). However, these commands (for both process IDs) generate no output.
If I run
I get this output about once a second:
Please advise how to proceed c.q. better diagnose this. Thank you.