Skip to content

Unable to run app due to "too many open files" #35

@robertgdev

Description

@robertgdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions