Skip to content

NativePHP Electron build fails on Windows due to missing fsevents dependency #691

@AsianManiac

Description

@AsianManiac

What were you trying to do?

I was trying to build my Laravel 12 + NativePHP Electron application on Windows 11 for production.

What happened?

  1. When running php artisan native:build, the build process fails because fsevents (a macOS-only dependency) is being required on Windows.

  2. On a fresh Laravel 12 app with nativephp/electron, the Windows PHP binaries directory only includes php-8.4.zip but not php-8.3.zip, while Linux and macOS include both 8.3 and 8.4.

To work around this, I must manually edit vendor/nativephp/electron/resources/js/php.js to force it to use 8.4 instead of 8.3.

The binaries folder vendor/nativephp/php-bin/bin/win/x64 is missing php-8.3.zip.

  1. Artisan commands php artisan native:db:seed and php artisan native:seed return "unknown command" on Windows (haven’t tested on Mac/Linux).

Because of these issues, Windows builds are currently not possible without manual hacks.

How to reproduce the bug

  1. Create a fresh Laravel 12 project on Windows 10.

  2. Install nativephp/electron.

  3. Run the app → observe missing php-8.3.zip in vendor/nativephp/php-bin/bin/win/x64.

Workaround: manually edit vendor/nativephp/electron/resources/js/php.js to use 8.4.

  1. Run:
    php artisan native:build

→ Build fails with ENOENT: no such file or directory, scandir '...\fsevents'.

  1. Run:
    php artisan native:db:seed
    php artisan native:seed

→ Both commands return unknown command.

Debug Output

renderer config is missing
vite v6.3.5 building SSR bundle for production...
transforming...
✓ 33 modules transformed.
rendering chunks...
out/main/index.js 70.33 kB
✓ built in 675ms
vite v6.3.5 building SSR bundle for production...
transforming...
✓ 1 modules transformed.
rendering chunks...
out/preload/index.mjs 0.17 kB
✓ built in 34ms
• electron-builder version=26.0.15 os=10.0.22000
• updater config { provider: 'spaces', name: null, region: null, path: null }
• loaded configuration file=C:\Users\AsianManiac\Herd\application\vendor\nativephp\electron\resources\js\electron-builder.js
• building php binary - exec php.js --win --x64
• skipped dependencies rebuild reason=npmRebuild is set to false
• packaging platform=win32 arch=x64 electron=32.3.3 appOutDir=C:\Users\AsianManiac\Herd\application\dist\win-unpacked
⨯ ENOENT: no such file or directory, scandir 'C:\Users\AsianManiac\Herd\application\vendor\nativephp\electron\resources\js\node_modules\fsevents'
failedTask=build
stackTrace=Error: ENOENT: no such file or directory, scandir '...\fsevents

Which operating systems have you seen this occur on?

Windows

Notes

Tested only on Windows 11, but likely reproducible on other Windows versions.

Environment:
Laravel: 12.0
NativePHP: latest (nativephp/electron)
PHP: 8.3 / 8.4

Node: installed via project dependencies

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