Skip to content

[Bug]: Unhandled exception when running native:serve #58

@Meyfarth

Description

@Meyfarth

What happened?

When running the php artisan native:serve command, it returns an unhandled exception when calling php.

I see an electron app starting in the dock, but when I click on it, only the default menu appears on top, I thought a window should appear.

Please note that I'm used to Symfony and never developed in Laravel 🙂

Thanks for your help 🙏

How to reproduce the bug

When I run the native:serve command, I see this error:

Starting NativePHP dev server…
Fetching latest dependencies…
Starting NativePHP app…
yarn run v1.22.19
warning package.json: No license field
$ electron-vite dev --watch
vite v4.3.9 building for development...

watching for file changes...

build started...
✓ 4 modules transformed.
out/main/index.js  0.54 kB
built in 81ms.

build the electron main process successfully

-----

vite v4.3.9 building for development...

watching for file changes...

build started...
transforming (1) src/preload/index.js"contextBridge" and "ipcRenderer" are imported from external module "electron" but never used in "src/preload/index.js".
✓ 1 modules transformed.
out/preload/index.js  0.70 kB
built in 15ms.

build the electron preload files successfully

-----

dev server running for the electron renderer process at:

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose

start electron app...

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:783:9)
    at execFile (node:child_process:359:17)
    at node:child_process:252:21
    at node:electron/js2c/asar_bundle:2:3130
    at /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:47:69
    at Generator.next (<anonymous>)
    at /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:4:12) {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

API server started on port 4000

Starting PHP server... /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/resources/php artisan serve /Users/xxxxxx/source/stocking-native-php

Making sure app folders are available

(node:57727) UnhandledPromiseRejectionWarning: Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at spawn (node:child_process:783:9)
    at callPhp (/Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:53:38)
    at /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:135:9
    at Generator.next (<anonymous>)
    at /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:4:12)
    at /Users/xxxxxx/source/stocking-native-php/vendor/nativephp/electron/resources/js/node_modules/nativephp-electron/dist/server/php.js:118:45
    at new Promise (<anonymous>)
(Use `Electron --trace-warnings ...` to show where the warning was created)

(node:57727) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

I also see an electron app starting in the dock, but when I click on it, only the menu appears on top.

Package Version

0.1.0

PHP Version

8.1.17

Laravel Version

10.15.0

Node Version

v19.8.1

Which operating systems does with happen with?

macOS

Notes

I first had the missing resources, for which I found a workaround in the issues.
Then I also tried to move the local php executable into the vendor/bin, without more success.

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