NativePHP / laravel

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

[Bug]: php artisan native:build fails #40

Closed Kuharenko closed 1 year ago

Kuharenko commented 1 year ago

What happened?

The native:build command doesn't work

image

How to reproduce the bug

Run the command php artisan native:build

Package Version

current

PHP Version

8.2.0

Laravel Version

10.0.0

Which operating systems does with happen with?

macOS

Notes

No response

fzhantw commented 1 year ago

Same here. With Apple M1 CPU

ArielMejiaDev commented 1 year ago

Apple M1 CPU too.

As far as I can (understand/imagine) there should be a publisher service in config/nativephp.php S3 or spaces... Looks like the env variables are important in the build process.

I do not know exactly how that process works... I think that we should wait until updating your app in docs get filled

multipacman commented 1 year ago

I noticed that there is entire folder missing on the nativePHP electron package when installed via composer.

When checking on previous commits the php.js file was available but inside a folder that is no longer available on the main branch source

I did replace the folders and changed the way BuildCommand.php file runs yarn and it worked.

In case you want to check the logs

Edit: dig some digging and found out that NativePHP electron package has been split to 2 packages where the ‘electron-plugin’ is being leveraged. Looks like that’s causing the build to fail.

Screenshot 2023-07-23 at 7 15 51 PM
vikasprogrammer commented 1 year ago

I have the same issue

Error: Cannot find module '/Users/folder/nativephp/vendor/nativephp/electron/resources/js/php.js'

wattsie commented 1 year ago

$issue++ along similar lines as above...

Mine runs with flags set to arm64 even though this machine is an MacPro (x86). Wonder if it is not being picked up on install etc? On quick look, didnt see any config option to override.

~/Development.local/nativephp/cronikl on  main ❯ php artisan native:build
Build NativePHP app…

up to date, audited 574 packages in 39s

81 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   INFO  Discovering packages.

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

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

> NativePHP@1.0.0 build:mac-arm
> cross-env node php.js --arm64 && cross-env npm run build && cross-env electron-builder -p never --mac --config --arm64

node:internal/modules/cjs/loader:1051
  throw err;
  ^

Error: Cannot find module '/Users/shane/Development.local/nativephp/cronikl/vendor/nativephp/electron/resources/js/php.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.5.0
wattsie commented 1 year ago

Second try on fresh project on a MacPro (x86)...

# Install a new copy of Laravel
laravel new nativephptest

# Change to that directory
cd nativephptest

# Add NativePHP
composer require nativephp/electron

# Run the installer
php artisan native:install

# Build
php artisan native:build
Output ``` ~/Development.local/nativephp ❯ laravel new nativephptest _ _ | | | | | | __ _ _ __ __ ___ _____| | | | / _` | '__/ _` \ \ / / _ \ | | |___| (_| | | | (_| |\ V / __/ | |______\__,_|_| \__,_| \_/ \___|_| Creating a "laravel/laravel" project at "./nativephptest" Info from https://repo.packagist.org: #StandWithUkraine Installing laravel/laravel (v10.2.5) - Downloading laravel/laravel (v10.2.5) - Installing laravel/laravel (v10.2.5): Extracting archive Created project in /Users/me/Development.local/nativephp/nativephptest > @php -r "file_exists('.env') || copy('.env.example', '.env');" Loading composer repositories with package information Updating dependencies Lock file operations: 108 installs, 0 updates, 0 removals - Locking brick/math (0.11.0) - Locking dflydev/dot-access-data (v3.0.2) - Locking doctrine/inflector (2.0.8) - Locking doctrine/lexer (3.0.0) - Locking dragonmantank/cron-expression (v3.3.2) - Locking egulias/email-validator (4.0.1) - Locking fakerphp/faker (v1.23.0) - Locking filp/whoops (2.15.3) - Locking fruitcake/php-cors (v1.2.0) - Locking graham-campbell/result-type (v1.1.1) - Locking guzzlehttp/guzzle (7.7.0) - Locking guzzlehttp/promises (2.0.0) - Locking guzzlehttp/psr7 (2.5.0) - Locking guzzlehttp/uri-template (v1.0.1) - Locking hamcrest/hamcrest-php (v2.0.1) - Locking laravel/framework (v10.16.1) - Locking laravel/pint (v1.10.5) - Locking laravel/sail (v1.23.1) - Locking laravel/sanctum (v3.2.5) - Locking laravel/serializable-closure (v1.3.1) - Locking laravel/tinker (v2.8.1) - Locking league/commonmark (2.4.0) - Locking league/config (v1.2.0) - Locking league/flysystem (3.15.1) - Locking league/flysystem-local (3.15.0) - Locking league/mime-type-detection (1.11.0) - Locking mockery/mockery (1.6.4) - Locking monolog/monolog (3.4.0) - Locking myclabs/deep-copy (1.11.1) - Locking nesbot/carbon (2.68.1) - Locking nette/schema (v1.2.3) - Locking nette/utils (v4.0.0) - Locking nikic/php-parser (v4.16.0) - Locking nunomaduro/collision (v7.7.0) - Locking nunomaduro/termwind (v1.15.1) - Locking phar-io/manifest (2.0.3) - Locking phar-io/version (3.2.1) - Locking phpoption/phpoption (1.9.1) - Locking phpunit/php-code-coverage (10.1.3) - Locking phpunit/php-file-iterator (4.0.2) - Locking phpunit/php-invoker (4.0.0) - Locking phpunit/php-text-template (3.0.0) - Locking phpunit/php-timer (6.0.0) - Locking phpunit/phpunit (10.2.6) - Locking psr/container (2.0.2) - Locking psr/event-dispatcher (1.0.0) - Locking psr/http-client (1.0.2) - Locking psr/http-factory (1.0.2) - Locking psr/http-message (2.0) - Locking psr/log (3.0.0) - Locking psr/simple-cache (3.0.0) - Locking psy/psysh (v0.11.19) - Locking ralouphie/getallheaders (3.0.3) - Locking ramsey/collection (2.0.0) - Locking ramsey/uuid (4.7.4) - Locking sebastian/cli-parser (2.0.0) - Locking sebastian/code-unit (2.0.0) - Locking sebastian/code-unit-reverse-lookup (3.0.0) - Locking sebastian/comparator (5.0.0) - Locking sebastian/complexity (3.0.0) - Locking sebastian/diff (5.0.3) - Locking sebastian/environment (6.0.1) - Locking sebastian/exporter (5.0.0) - Locking sebastian/global-state (6.0.1) - Locking sebastian/lines-of-code (2.0.0) - Locking sebastian/object-enumerator (5.0.0) - Locking sebastian/object-reflector (3.0.0) - Locking sebastian/recursion-context (5.0.0) - Locking sebastian/type (4.0.0) - Locking sebastian/version (4.0.1) - Locking spatie/backtrace (1.5.3) - Locking spatie/flare-client-php (1.4.1) - Locking spatie/ignition (1.9.0) - Locking spatie/laravel-ignition (2.2.0) - Locking symfony/console (v6.3.0) - Locking symfony/css-selector (v6.3.0) - Locking symfony/deprecation-contracts (v3.3.0) - Locking symfony/error-handler (v6.3.0) - Locking symfony/event-dispatcher (v6.3.0) - Locking symfony/event-dispatcher-contracts (v3.3.0) - Locking symfony/finder (v6.3.0) - Locking symfony/http-foundation (v6.3.1) - Locking symfony/http-kernel (v6.3.1) - Locking symfony/mailer (v6.3.0) - Locking symfony/mime (v6.3.0) - Locking symfony/polyfill-ctype (v1.27.0) - Locking symfony/polyfill-intl-grapheme (v1.27.0) - Locking symfony/polyfill-intl-idn (v1.27.0) - Locking symfony/polyfill-intl-normalizer (v1.27.0) - Locking symfony/polyfill-mbstring (v1.27.0) - Locking symfony/polyfill-php72 (v1.27.0) - Locking symfony/polyfill-php80 (v1.27.0) - Locking symfony/polyfill-php83 (v1.27.0) - Locking symfony/polyfill-uuid (v1.27.0) - Locking symfony/process (v6.3.0) - Locking symfony/routing (v6.3.1) - Locking symfony/service-contracts (v3.3.0) - Locking symfony/string (v6.3.0) - Locking symfony/translation (v6.3.0) - Locking symfony/translation-contracts (v3.3.0) - Locking symfony/uid (v6.3.0) - Locking symfony/var-dumper (v6.3.1) - Locking symfony/yaml (v6.3.0) - Locking theseer/tokenizer (1.2.1) - Locking tijsverkoyen/css-to-inline-styles (2.2.6) - Locking vlucas/phpdotenv (v5.5.0) - Locking voku/portable-ascii (2.0.1) - Locking webmozart/assert (1.11.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 108 installs, 0 updates, 0 removals - Downloading laravel/serializable-closure (v1.3.1) - Downloading laravel/framework (v10.16.1) - Downloading phpunit/php-code-coverage (10.1.3) - Installing doctrine/inflector (2.0.8): Extracting archive - Installing doctrine/lexer (3.0.0): Extracting archive - Installing symfony/polyfill-ctype (v1.27.0): Extracting archive - Installing webmozart/assert (1.11.0): Extracting archive - Installing dragonmantank/cron-expression (v3.3.2): Extracting archive - Installing symfony/deprecation-contracts (v3.3.0): Extracting archive - Installing psr/container (2.0.2): Extracting archive - Installing fakerphp/faker (v1.23.0): Extracting archive - Installing symfony/polyfill-php80 (v1.27.0): Extracting archive - Installing symfony/polyfill-php83 (v1.27.0): Extracting archive - Installing symfony/polyfill-mbstring (v1.27.0): Extracting archive - Installing symfony/http-foundation (v6.3.1): Extracting archive - Installing fruitcake/php-cors (v1.2.0): Extracting archive - Installing psr/http-message (2.0): Extracting archive - Installing psr/http-client (1.0.2): Extracting archive - Installing ralouphie/getallheaders (3.0.3): Extracting archive - Installing psr/http-factory (1.0.2): Extracting archive - Installing guzzlehttp/psr7 (2.5.0): Extracting archive - Installing guzzlehttp/promises (2.0.0): Extracting archive - Installing guzzlehttp/guzzle (7.7.0): Extracting archive - Installing guzzlehttp/uri-template (v1.0.1): Extracting archive - Installing laravel/pint (v1.10.5): Extracting archive - Installing symfony/yaml (v6.3.0): Extracting archive - Installing voku/portable-ascii (2.0.1): Extracting archive - Installing phpoption/phpoption (1.9.1): Extracting archive - Installing graham-campbell/result-type (v1.1.1): Extracting archive - Installing vlucas/phpdotenv (v5.5.0): Extracting archive - Installing symfony/css-selector (v6.3.0): Extracting archive - Installing tijsverkoyen/css-to-inline-styles (2.2.6): Extracting archive - Installing symfony/var-dumper (v6.3.1): Extracting archive - Installing symfony/polyfill-uuid (v1.27.0): Extracting archive - Installing symfony/uid (v6.3.0): Extracting archive - Installing symfony/routing (v6.3.1): Extracting archive - Installing symfony/process (v6.3.0): Extracting archive - Installing symfony/polyfill-php72 (v1.27.0): Extracting archive - Installing symfony/polyfill-intl-normalizer (v1.27.0): Extracting archive - Installing symfony/polyfill-intl-idn (v1.27.0): Extracting archive - Installing symfony/mime (v6.3.0): Extracting archive - Installing symfony/service-contracts (v3.3.0): Extracting archive - Installing psr/event-dispatcher (1.0.0): Extracting archive - Installing symfony/event-dispatcher-contracts (v3.3.0): Extracting archive - Installing symfony/event-dispatcher (v6.3.0): Extracting archive - Installing psr/log (3.0.0): Extracting archive - Installing egulias/email-validator (4.0.1): Extracting archive - Installing symfony/mailer (v6.3.0): Extracting archive - Installing symfony/error-handler (v6.3.0): Extracting archive - Installing symfony/http-kernel (v6.3.1): Extracting archive - Installing symfony/finder (v6.3.0): Extracting archive - Installing symfony/polyfill-intl-grapheme (v1.27.0): Extracting archive - Installing symfony/string (v6.3.0): Extracting archive - Installing symfony/console (v6.3.0): Extracting archive - Installing ramsey/collection (2.0.0): Extracting archive - Installing brick/math (0.11.0): Extracting archive - Installing ramsey/uuid (4.7.4): Extracting archive - Installing psr/simple-cache (3.0.0): Extracting archive - Installing nunomaduro/termwind (v1.15.1): Extracting archive - Installing symfony/translation-contracts (v3.3.0): Extracting archive - Installing symfony/translation (v6.3.0): Extracting archive - Installing nesbot/carbon (2.68.1): Extracting archive - Installing monolog/monolog (3.4.0): Extracting archive - Installing league/mime-type-detection (1.11.0): Extracting archive - Installing league/flysystem (3.15.1): Extracting archive - Installing league/flysystem-local (3.15.0): Extracting archive - Installing nette/utils (v4.0.0): Extracting archive - Installing nette/schema (v1.2.3): Extracting archive - Installing dflydev/dot-access-data (v3.0.2): Extracting archive - Installing league/config (v1.2.0): Extracting archive - Installing league/commonmark (2.4.0): Extracting archive - Installing laravel/serializable-closure (v1.3.1): Extracting archive - Installing laravel/framework (v10.16.1): Extracting archive - Installing laravel/sail (v1.23.1): Extracting archive - Installing laravel/sanctum (v3.2.5): Extracting archive - Installing nikic/php-parser (v4.16.0): Extracting archive - Installing psy/psysh (v0.11.19): Extracting archive - Installing laravel/tinker (v2.8.1): Extracting archive - Installing hamcrest/hamcrest-php (v2.0.1): Extracting archive - Installing mockery/mockery (1.6.4): Extracting archive - Installing filp/whoops (2.15.3): Extracting archive - Installing nunomaduro/collision (v7.7.0): Extracting archive - Installing sebastian/version (4.0.1): Extracting archive - Installing sebastian/type (4.0.0): Extracting archive - Installing sebastian/recursion-context (5.0.0): Extracting archive - Installing sebastian/object-reflector (3.0.0): Extracting archive - Installing sebastian/object-enumerator (5.0.0): Extracting archive - Installing sebastian/global-state (6.0.1): Extracting archive - Installing sebastian/exporter (5.0.0): Extracting archive - Installing sebastian/environment (6.0.1): Extracting archive - Installing sebastian/diff (5.0.3): Extracting archive - Installing sebastian/comparator (5.0.0): Extracting archive - Installing sebastian/code-unit (2.0.0): Extracting archive - Installing sebastian/cli-parser (2.0.0): Extracting archive - Installing phpunit/php-timer (6.0.0): Extracting archive - Installing phpunit/php-text-template (3.0.0): Extracting archive - Installing phpunit/php-invoker (4.0.0): Extracting archive - Installing phpunit/php-file-iterator (4.0.2): Extracting archive - Installing theseer/tokenizer (1.2.1): Extracting archive - Installing sebastian/lines-of-code (2.0.0): Extracting archive - Installing sebastian/complexity (3.0.0): Extracting archive - Installing sebastian/code-unit-reverse-lookup (3.0.0): Extracting archive - Installing phpunit/php-code-coverage (10.1.3): Extracting archive - Installing phar-io/version (3.2.1): Extracting archive - Installing phar-io/manifest (2.0.3): Extracting archive - Installing myclabs/deep-copy (1.11.1): Extracting archive - Installing phpunit/phpunit (10.2.6): Extracting archive - Installing spatie/backtrace (1.5.3): Extracting archive - Installing spatie/flare-client-php (1.4.1): Extracting archive - Installing spatie/ignition (1.9.0): Extracting archive - Installing spatie/laravel-ignition (2.2.0): Extracting archive 43 package suggestions were added by new dependencies, use `composer suggest` to see details. Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. laravel/sail ................................................................................................................................ DONE laravel/sanctum ............................................................................................................................. DONE laravel/tinker .............................................................................................................................. DONE nesbot/carbon ............................................................................................................................... DONE nunomaduro/collision ........................................................................................................................ DONE nunomaduro/termwind ......................................................................................................................... DONE spatie/laravel-ignition ..................................................................................................................... DONE 82 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force INFO No publishable resources for tag [laravel-assets]. No security vulnerability advisories found > @php artisan key:generate --ansi INFO Application key set successfully. INFO Application ready! Build something amazing. ~/Development.local/nativephp ❯ cd nativephptest took  53s ~/Development.local/nativephp/nativephptest ❯ composer require nativephp/electron Info from https://repo.packagist.org: #StandWithUkraine ./composer.json has been updated Running composer update nativephp/electron Loading composer repositories with package information Updating dependencies Lock file operations: 4 installs, 0 updates, 0 removals - Locking nativephp/electron (0.2.0) - Locking nativephp/laravel (0.1.1) - Locking nativephp/php-bin (0.2.0) - Locking spatie/laravel-package-tools (1.15.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 4 installs, 0 updates, 0 removals - Downloading nativephp/php-bin (0.2.0) - Downloading nativephp/laravel (0.1.1) - Downloading nativephp/electron (0.2.0) - Installing spatie/laravel-package-tools (1.15.0): Extracting archive - Installing nativephp/php-bin (0.2.0): Extracting archive - Installing nativephp/laravel (0.1.1): Extracting archive - Installing nativephp/electron (0.2.0): Extracting archive Generating optimized autoload files > Illuminate\Foundation\ComposerScripts::postAutoloadDump > @php artisan package:discover --ansi INFO Discovering packages. laravel/sail ................................................................................................................................ DONE laravel/sanctum ............................................................................................................................. DONE laravel/tinker .............................................................................................................................. DONE nativephp/electron .......................................................................................................................... DONE nativephp/laravel ........................................................................................................................... DONE nesbot/carbon ............................................................................................................................... DONE nunomaduro/collision ........................................................................................................................ DONE nunomaduro/termwind ......................................................................................................................... DONE spatie/laravel-ignition ..................................................................................................................... DONE 83 packages you are using are looking for funding. Use the `composer fund` command to find out more! > @php artisan vendor:publish --tag=laravel-assets --ansi --force INFO No publishable resources for tag [laravel-assets]. No security vulnerability advisories found Using version ^0.2.0 for nativephp/electron ~/Development.local/nativephp/nativephptest ❯ php artisan native:install took  26s Publishing NativePHP Service Provider... Would you like to install the NativePHP NPM dependencies? (yes/no) [yes]: > yes Fetching latest dependencies… > NativePHP@1.0.0 postinstall > electron-builder install-app-deps • electron-builder version=24.6.2 Binary Source: /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/php-bin/bin/mac Binary Filename: php Arch: x64 Platform: darwin Copying PHP file(s) from /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/php-bin/bin/mac/x86 to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied PHP binary to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied certificate file to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/cacert.pem • loaded configuration file=/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/electron-builder.js added 573 packages, and audited 574 packages in 59s 81 packages are looking for funding run `npm fund` for details found 0 vulnerabilities Would you like to start the NativePHP development server (yes/no) [no]: > NativePHP scaffolding installed successfully. ~/Development.local/nativephp/nativephptest ❯ ~/Development.local/nativephp/nativephptest ❯ php artisan native:build took  46s Build NativePHP app… changed 12 packages, and audited 574 packages in 37s 81 packages are looking for funding run `npm fund` for details found 0 vulnerabilities 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.0) - Removing spatie/laravel-ignition (2.2.0) - Removing spatie/ignition (1.9.0) - Removing spatie/flare-client-php (1.4.1) - 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.2.6) - 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.7.0) - Removing myclabs/deep-copy (1.11.1) - Removing mockery/mockery (1.6.4) - 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% 24/27 [========================>---] 88% 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:mac-arm > cross-env node php.js --arm64 && cross-env npm run build && cross-env electron-builder -p never --mac --config --arm64 Error copying PHP binary Error: EPERM: operation not permitted, unlink '/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php' at Object.unlinkSync (node:fs:1899:3) at mayCopyFile (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:59:8) at onFile (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:10) at getStats (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44) at startCopy (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:38:10) at handleFilterAndCopy (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:33:10) at copySync (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:26:10) at Object. (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/php.js:8:9) at Module._compile (node:internal/modules/cjs/loader:1233:14) at Module._extensions..js (node:internal/modules/cjs/loader:1287:10) { errno: -1, syscall: 'unlink', code: 'EPERM', path: '/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php' } > 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 114ms 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 19ms vite v4.4.7 building for production... ✓ 2 modules transformed. Generated an empty chunk: "index". ../../out/renderer/index.html 0.37 kB ✓ built in 447ms • electron-builder version=24.6.3 os=21.6.0 Binary Source: /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/php-bin/bin/mac Binary Filename: php Arch: x64 Platform: darwin Copying PHP file(s) from /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/php-bin/bin/mac/x86 to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied PHP binary to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied certificate file to /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/cacert.pem ===================== Building for darwin | x64 ===================== updater config { provider: 'spaces', name: null, region: null, path: null } ===================== ===================== Copied app to resources /Users/me/Development.local/nativephp/nativephptest/dist ===================== • loaded configuration file=/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/electron-builder.js • writing effective config file=/Users/me/Development.local/nativephp/nativephptest/dist/builder-effective-config.yaml • skipped dependencies rebuild reason=npmRebuild is set to false • packaging platform=darwin arch=arm64 electron=25.3.2 appOutDir=/Users/me/Development.local/nativephp/nativephptest/dist/mac-arm64 ⨯ Get "https://github.com/electron/electron/releases/download/v25.3.2/electron-v25.3.2-darwin-arm64.zip": dial tcp 20.248.137.48:443: connect: bad file descriptor github.com/develar/app-builder/pkg/download.(*Downloader).follow.func1 /Volumes/data/Documents/app-builder/pkg/download/downloader.go:206 github.com/develar/app-builder/pkg/download.(*Downloader).follow /Volumes/data/Documents/app-builder/pkg/download/downloader.go:234 github.com/develar/app-builder/pkg/download.(*Downloader).DownloadNoRetry /Volumes/data/Documents/app-builder/pkg/download/downloader.go:128 github.com/develar/app-builder/pkg/download.(*Downloader).Download /Volumes/data/Documents/app-builder/pkg/download/downloader.go:112 github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).doDownload /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:192 github.com/develar/app-builder/pkg/electron.(*ElectronDownloader).Download /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:177 github.com/develar/app-builder/pkg/electron.downloadElectron.func1.1 /Volumes/data/Documents/app-builder/pkg/electron/electronDownloader.go:73 github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2 /Volumes/data/Documents/app-builder/pkg/util/async.go:68 runtime.goexit /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_amd64.s:1581 ⨯ /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/app-builder-bin/mac/app-builder_amd64 process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Exit code: 1 failedTask=build stackTrace=Error: /Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/app-builder-bin/mac/app-builder_amd64 process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Exit code: 1 at ChildProcess. (/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/builder-util/src/util.ts:250:14) at Object.onceWrapper (node:events:629:26) at ChildProcess.emit (node:events:514:28) at maybeClose (node:internal/child_process:1105:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5) ~/Development.local/nativephp/nativephptest ❯ took  1m 13s ```

Quick update, if I modify the file vendor/nativephp/electron/src/Commands/BuildCommand.php line: 36 from: ->run('npm run build:mac-arm', function (string $type, string $output) { to ->run('npm run build:mac-x86', function (string $type, string $output) { I can now get it to builld.

I still get the "unlink" error, all perms are correct, even moved into main home directory to be sure. Error copying PHP binary Error: EPERM: operation not permitted, unlink '/Users/shane/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php'

~/tmp/nativephptest ❯ ls -al /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php
total 46792
drwxr-xr-x  3 me  staff        96 27 Jul 19:14 .
drwxr-xr-x  9 me  staff       288 27 Jul 19:14 ..
-rwxr-xr-x  1 me  staff  23954688 27 Jul 19:14 php

Also, looks like the storage folder is not linked by default, i.e., need to run php artisan storage:link

Output ``` ~/tmp/nativephptest ❯ php artisan native:build -vvv took  1m 0s Build NativePHP app… up to date, audited 574 packages in 11s 81 packages are looking for funding run `npm fund` for details found 0 vulnerabilities Running 2.5.8 (2023-06-09 17:13:21) with PHP 8.2.8 on Darwin / 21.6.0 Reading ./composer.json (/Users/me/tmp/nativephptest/composer.json) Loading config file /Users/me/.composer/config.json Loading config file /Users/me/.composer/auth.json Loading config file ./composer.json (/Users/me/tmp/nativephptest/composer.json) Checked CA file /usr/local/etc/ca-certificates/cert.pem: valid Executing command (/Users/me/tmp/nativephptest): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v' Executing command (/Users/me/tmp/nativephptest): git describe --exact-match --tags Executing command (CWD): git --version Executing command (/Users/me/tmp/nativephptest): git log --pretty="%H" -n1 HEAD --no-show-signature Executing command (/Users/me/tmp/nativephptest): hg branch Executing command (/Users/me/tmp/nativephptest): fossil branch list Executing command (/Users/me/tmp/nativephptest): fossil tag list Executing command (/Users/me/tmp/nativephptest): svn info --xml Reading /Users/me/.composer/composer.json Loading config file /Users/me/.composer/config.json Loading config file /Users/me/.composer/auth.json Loading config file /Users/me/.composer/composer.json (/Users/me/.composer/composer.json) Loading config file /Users/me/.composer/auth.json Reading /Users/me/.composer/auth.json Reading /Users/me/tmp/nativephptest/vendor/composer/installed.json Reading /Users/me/.composer/vendor/composer/installed.json Reading ./composer.lock (/Users/me/tmp/nativephptest/composer.lock) Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Reading ./composer.lock (/Users/me/tmp/nativephptest/composer.lock) Built pool. Generating rules Resolving dependencies through SAT Looking at all rules. Dependency resolution completed in 0.001 seconds Nothing to install, update or remove Generating optimized autoload files > post-autoload-dump: Illuminate\Foundation\ComposerScripts::postAutoloadDump > post-autoload-dump: @php artisan package:discover --ansi Executing command (CWD): '/usr/local/Cellar/php/8.2.8/bin/php' -d allow_url_fopen='1' -d disable_functions='' -d memory_limit='1536M' 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:mac-x86 > cross-env node php.js --x64 && cross-env npm run build && cross-env electron-builder -p never --mac --config --x64 Error copying PHP binary Error: EPERM: operation not permitted, unlink '/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php' at Object.unlinkSync (node:fs:1899:3) at mayCopyFile (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:59:8) at onFile (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:54:10) at getStats (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:48:44) at startCopy (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:38:10) at handleFilterAndCopy (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:33:10) at copySync (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:26:10) at Object. (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/php.js:8:9) at Module._compile (node:internal/modules/cjs/loader:1233:14) at Module._extensions..js (node:internal/modules/cjs/loader:1287:10) { errno: -1, syscall: 'unlink', code: 'EPERM', path: '/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php' } > 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 134ms 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 19ms vite v4.4.7 building for production... ✓ 2 modules transformed. Generated an empty chunk: "index". ../../out/renderer/index.html 0.37 kB ✓ built in 447ms • electron-builder version=24.6.3 os=21.6.0 Binary Source: /Users/me/tmp/nativephptest/vendor/nativephp/php-bin/bin/mac Binary Filename: php Arch: x64 Platform: darwin Copying PHP file(s) from /Users/me/tmp/nativephptest/vendor/nativephp/php-bin/bin/mac/x86 to /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied PHP binary to /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/php Copied certificate file to /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/resources/cacert.pem ===================== Building for darwin | x64 ===================== updater config { provider: 'spaces', name: null, region: null, path: null } ===================== ===================== Error copying app to resources Error: ENOENT: no such file or directory, stat '/Users/me/tmp/nativephptest/public/storage' at Object.statSync (node:fs:1706:3) at Object.statSync (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/graceful-fs/polyfills.js:318:34) at statSync (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/util/stat.js:10:52) at getStatsSync (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/util/stat.js:24:19) at Object.checkPathsSync (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/util/stat.js:49:33) at copyDirItem (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:121:29) at /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:115:39 at Array.forEach () at copyDir (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:115:23) at mkDirAndCopy (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:110:3) at onDir (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:101:25) at getStats (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:45:37) at startCopy (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:38:10) at copyDirItem (/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:122:10) at /Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/node_modules/fs-extra/lib/copy-sync/copy-sync.js:115:39 at Array.forEach () { errno: -2, syscall: 'stat', code: 'ENOENT', path: '/Users/me/tmp/nativephptest/public/storage' } ===================== • loaded configuration file=/Users/me/tmp/nativephptest/vendor/nativephp/electron/resources/js/electron-builder.js • writing effective config file=/Users/me/tmp/nativephptest/dist/builder-effective-config.yaml • skipped dependencies rebuild reason=npmRebuild is set to false • packaging platform=darwin arch=x64 electron=25.3.2 appOutDir=/Users/me/tmp/nativephptest/dist/mac • downloading url=https://github.com/electron/electron/releases/download/v25.3.2/electron-v25.3.2-darwin-x64.zip size=92 MB parts=8 • downloaded url=https://github.com/electron/electron/releases/download/v25.3.2/electron-v25.3.2-darwin-x64.zip duration=12.214s • do not use "" as appId, "com.electron.laravel" will be used instead • signing file=/Users/me/tmp/nativephptest/dist/mac/Laravel.app identityName=Developer ID Application: me (xxxx) identityHash=xxxxx provisioningProfile=none aftersign hook triggered, start to notarize app. skipping notarizing, not in CI. • building target=macOS zip arch=x64 file=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-x64.zip • building target=DMG arch=x64 file=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-x64.dmg • skipped dependencies rebuild reason=npmRebuild is set to false • packaging platform=darwin arch=arm64 electron=25.3.2 appOutDir=/Users/me/tmp/nativephptest/dist/mac-arm64 • downloading url=https://github.com/electron/electron/releases/download/v25.3.2/electron-v25.3.2-darwin-arm64.zip size=88 MB parts=8 • downloaded url=https://github.com/electron/electron/releases/download/v25.3.2/electron-v25.3.2-darwin-arm64.zip duration=6.461s • building block map blockMapFile=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-x64.dmg.blockmap • do not use "" as appId, "com.electron.laravel" will be used instead • signing file=/Users/me/tmp/nativephptest/dist/mac-arm64/Laravel.app identityName=Developer ID Application: me (xxxx) identityHash=xxxxx provisioningProfile=none • building block map blockMapFile=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-x64.zip.blockmap aftersign hook triggered, start to notarize app. skipping notarizing, not in CI. • building target=macOS zip arch=arm64 file=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-arm64.zip • building target=DMG arch=arm64 file=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-arm64.dmg • building block map blockMapFile=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-arm64.dmg.blockmap • building block map blockMapFile=/Users/me/tmp/nativephptest/dist/Laravel-1.0.0-arm64.zip.blockmap ~/tmp/nativephptest ❯ took  4m 36s ```
vikasprogrammer commented 1 year ago

@wattsie i think you have an issue with permission

Error copying PHP binary Error: EPERM: operation not permitted, unlink '/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php'
wattsie commented 1 year ago

@wattsie i think you have an issue with permission

Error copying PHP binary Error: EPERM: operation not permitted, unlink '/Users/me/Development.local/nativephp/nativephptest/vendor/nativephp/electron/resources/js/resources/php'

thanks.

I have double checked permissions. I have many (over a hundred) projects in this folder that do not have issues with permissions. I will triple check when I get home again.

Cheers.

vikasprogrammer commented 1 year ago

I have a different error:

Building for ARM64
/Users/vikas/code/playground/nativephp/vendor/nativephp/electron/bin/arm64/php
=====================
updater config { provider: 'spaces', name: null, region: null, path: null }
=====================
=====================
Copied app to resources
/Users/vikas/code/playground/nativephp/dist
=====================
/bin/sh: /Users/vikas/code/playground/nativephp/vendor/nativephp/php-bin/bin/mac/arm64/php: Bad CPU type in executable
=====================
Error copying app to resources
Error: Command failed: /Users/vikas/code/playground/nativephp/vendor/nativephp/php-bin/bin/mac/arm64/php /Users/vikas/code/playground/nativephp/vendor/nativephp/electron/resources/js/resources/app/artisan native:minify /Users/vikas/code/playground/nativephp/vendor/nativephp/electron/resources/js/resources/app
/bin/sh: /Users/vikas/code/playground/nativephp/vendor/nativephp/php-bin/bin/mac/arm64/php: Bad CPU type in executable

Someone it is identifying my Intel Mac as ARM64.

mpociot commented 1 year ago

This should now be fixed with 0.3.0 of the nativephp/electron package 🤞

ahmed-almabhuoh commented 1 year ago

Where I can get the exported file ?! image

ryanlovett-au commented 1 year ago

The build output can be found in /vendor/nativephp/electron/resources/js/dist in your repo tree...