NativePHP / laravel

Laravel wrapper for the NativePHP framework
https://nativephp.com
MIT License
3.17k stars 163 forks source link

[Bug]: php artisan native:build does nothing #154

Closed hcancelik closed 6 months ago

hcancelik commented 1 year ago

What happened?

After running php artisan native:build I get the following output. No files are generated.

Build NativePHP app…
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 37 removals
  - Removing theseer/tokenizer (1.2.1)
  - Removing symfony/yaml (v6.3.3)
  - Removing spatie/laravel-ignition (2.2.0)
  - Removing spatie/ignition (1.9.0)
  - Removing spatie/flare-client-php (1.4.2)
  - Removing spatie/backtrace (1.5.3)
  - Removing sebastian/version (4.0.1)
  - Removing sebastian/type (4.0.0)
  - Removing sebastian/recursion-context (5.0.0)
  - Removing sebastian/object-reflector (3.0.0)
  - Removing sebastian/object-enumerator (5.0.0)
  - Removing sebastian/lines-of-code (2.0.0)
  - Removing sebastian/global-state (6.0.1)
  - Removing sebastian/exporter (5.0.0)
  - Removing sebastian/environment (6.0.1)
  - Removing sebastian/diff (5.0.3)
  - Removing sebastian/complexity (3.0.0)
  - Removing sebastian/comparator (5.0.0)
  - Removing sebastian/code-unit-reverse-lookup (3.0.0)
  - Removing sebastian/code-unit (2.0.0)
  - Removing sebastian/cli-parser (2.0.0)
  - Removing phpunit/phpunit (10.3.1)
  - Removing phpunit/php-timer (6.0.0)
  - Removing phpunit/php-text-template (3.0.0)
  - Removing phpunit/php-invoker (4.0.0)
  - Removing phpunit/php-file-iterator (4.0.2)
  - Removing phpunit/php-code-coverage (10.1.3)
  - Removing phar-io/version (3.2.1)
  - Removing phar-io/manifest (2.0.3)
  - Removing nunomaduro/collision (v7.8.0)
  - Removing myclabs/deep-copy (1.11.1)
  - Removing mockery/mockery (1.6.5)
  - Removing laravel/sail (v1.23.1)
  - Removing laravel/pint (v1.10.5)
  - Removing hamcrest/hamcrest-php (v2.0.1)
  - Removing filp/whoops (2.15.3)
  - Removing fakerphp/faker (v1.23.0)
  0/27 [>---------------------------]   0%
 10/27 [==========>-----------------]  37%
 19/27 [===================>--------]  70%
 26/27 [==========================>-]  96%
 27/27 [============================] 100%
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

  laravel/sanctum ....................................................... DONE
  laravel/tinker ........................................................ DONE
  nativephp/electron .................................................... DONE
  nativephp/laravel ..................................................... DONE
  nesbot/carbon ......................................................... DONE
  nunomaduro/termwind ................................................... DONE

53 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

> NativePHP@1.0.0 build
> electron-vite build

vite v4.4.7 building for production...
✓ 4 modules transformed.
out/main/index.js  0.55 kB
✓ built in 97ms
vite v4.4.7 building for production...
"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 16ms
vite v4.4.7 building for production...
✓ 2 modules transformed.
Generated an empty chunk: "index".
../../out/renderer/index.html  0.37 kB
✓ built in 395ms

How to reproduce the bug

Created a brand new laravel project and required the nativephp/electron package.

Package Version

0.3.3

PHP Version

8.2.8

Laravel Version

10.17.1

Node Version

18.15.0

Which operating systems does with happen with?

macOS

Notes

No response

sbritz commented 1 year ago

same here

My Mac: Intel Core i9 macOS Monterey (12.6.3)

Jonnx commented 1 year ago

same here

My Mac: Intel Core i7 macOS Ventura (13.2.1)

have not been able to build a shippable app instance on intel mac yet. dev server works totally fine which is really odd. but with the latest release, the x86 php-bin executable was moved into the folder for the build script to find it. so i am keeping my fingers crossed for the next release.

Jonnx commented 1 year ago

got the app to build using the following command sequence

cp vendor/nativephp/php-bin/bin/mac/arm64/php vendor/nativephp/php-bin/bin/mac/arm64/php.bak
cp vendor/nativephp/php-bin/bin/mac/x86/php vendor/nativephp/php-bin/bin/mac/arm64/php
php artisan native:build mac

then i installed the app via x64.dmg file and it actually launched the window, set the menu and loaded my UI. Success!

however, interacting with the sqlite db was not possible (forms would not submit) and checking the app logs i am seeing something about the command native:config not existing. which appears to be another open issue: https://github.com/NativePHP/laravel/issues/168

worked around it by manually temporarily by registering the native migrate and config commands in my console kernel

omitobi commented 6 months ago

PHP 8.1 solves the issue.

simonhamp commented 6 months ago

Please update to nativephp/electron v0.6 and try again.

Many issues around builds have been resolved in recent releases.