Skip to content

[Bug]: Missing commands, native:config and native:php-ini #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
adammpkins opened this issue Aug 10, 2023 · 16 comments
Closed

[Bug]: Missing commands, native:config and native:php-ini #168

adammpkins opened this issue Aug 10, 2023 · 16 comments
Labels
bug Something isn't working

Comments

@adammpkins
Copy link

adammpkins commented Aug 10, 2023

What happened?

When I install a fresh application and require NativePHP, and attempt to bring it up with native:serve, I get an error in the output stating

Error: Command failed: /home/adammpkins/Development/NativePHP/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config

    at ChildProcess.exithandler (node:child_process:430:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:322:12) {
  code: 1,
  killed: false,
  signal: null,
  cmd: '/home/adammpkins/Development/NativePHP/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config',
  stdout: '\n' +
    '   ERROR  Command "native:config" is not defined. Did you mean one of these?  \n' +
    '\n' +
    '  ⇂ native:build  \n' +
    '  ⇂ native:install  \n' +
    '  ⇂ native:migrate  \n' +
    '  ⇂ native:minify  \n' +
    '  ⇂ native:publish  \n' +
    '  ⇂ native:queue  \n' +
    '  ⇂ native:serve  \n' +
    '\n',
  stderr: ''
}


I see commands for LoadPHPConfigurationCommand and LoadStartupConfigurationCommand but the application doesn't seem to see them.

How to reproduce the bug

Install Laravel via

curl -s "https://laravel.build/NativePHP" | bash

require nativephp via

composer require nativephp/electron

Attempt to bring the application up with

php artisan native:serve

Package Version

0.4.0

PHP Version

8.2.0

Laravel Version

10

Node Version

20.3.1

Which operating systems does with happen with?

Linux

Notes

No response

@adammpkins adammpkins added the bug Something isn't working label Aug 10, 2023
@JayBizzle
Copy link

Seems related to this commit - 6a43575

if (config('nativephp-internal.running')) {

...always seems to be false

@Jonnx
Copy link

Jonnx commented Aug 11, 2023

+1 on intel mac

@mhoffmann777
Copy link

mhoffmann777 commented Aug 11, 2023

Same for all commands in vendor/nativephp/laravel/src/Commands/

On M1 MacBookPro

@PriceNathan
Copy link

db:seed also doesn't work

@valpuia604
Copy link

valpuia604 commented Aug 18, 2023

Same as #160.

@keenminded
Copy link

Please take a look at my comment in #160 (comment)

@danielpetrica
Copy link
Contributor

A workaround which seems to work for me is adding this environment variable

NATIVEPHP_RUNNING=true

@ralphmorris
Copy link

+1 on this. Mac Pro M1

@ricvillagrana
Copy link

+1 for Intel.

@hussainweb
Copy link

The fix is present in the HEAD of https://github.com/NativePHP/electron-plugin (see file) but it is not tagged. The current version of nativephp/electron package is locked to version 0.2.0 of that plugin. There is a version 0.3.0 of the plugin but the fix was made after that. I can't figure out how to install untagged releases of npm packages so I can't try the latest HEAD release.

It looks like we have to wait for the next version of the plugin and then corresponding updates to the lock file in nativephp/electron. Meanwhile, I got it working by adding the environment variable manually to php.js in the retrieveNativePHPConfig function (lines 40-42):

        const env = {
            NATIVEPHP_STORAGE_PATH: storagePath,
            NATIVEPHP_DATABASE_PATH: databaseFile,
            NATIVEPHP_RUNNING: true,
        };

@ThibautPV
Copy link

Same problem on Mac M2

I try to add "NATIVEPHP_RUNNING: true,", without success. Always the same problem.

Error :


Error: Command failed: /Users/***/***/***/nativephptest/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config

    at ChildProcess.exithandler (node:child_process:430:12)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5) {
  code: 255,
  killed: false,
  signal: null,
  cmd: '/Users/***/***/***/nativephptest/vendor/nativephp/electron/resources/js/resources/php/php artisan native:config',
  stdout: '\n' +
    'Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.17. in /Users/***/***/***/nativephptest/vendor/composer/platform_check.php on line 24\n',
  stderr: ''
}

@nickpoulos
Copy link

Has there been any progress or workarounds found for this issue? 🙏

It is kind of a deal breaker for experimenting with NativePHP.

@simonhamp
Copy link
Member

'Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.17. in /Users///***/nativephptest/vendor/composer/platform_check.php on line 24\n'

@ThibautPV your issue is different. It seems you've installed your Composer dependencies under PHP8.2 while NativePHP currently uses PHP8.1.

This can be fixed by running composer install with PHP8.1.

Alternatively, the version of PHP inside NativePHP needs to match your system. More PHP versions are coming soon.

@simonhamp
Copy link
Member

@nickpoulos which issue are you experiencing? There seem to be multiple ones referenced here

@omitobi
Copy link

omitobi commented Apr 25, 2024

Before: Trying to run it on PHP 8.2, I got this same error.

Running it on PHP 8.1 fixes this issue for me.

@simonhamp
Copy link
Member

The issue with the missing NATIVEPHP_RUNNING environment variable should be solved.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.