tmdh / laravel-kit

A desktop Laravel admin panel app
https://tmdh.github.io/laravel-kit/
GNU General Public License v2.0
1.26k stars 137 forks source link

Kit is using the wrong php version #15

Closed SamuelNitsche closed 3 years ago

SamuelNitsche commented 3 years ago

When I open a project, I get the following error message.

Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.11. in /xxx/vendor/composer/platform_check.php on line 24

Running php -v outputs the correct PHP version which I am using.

PHP 8.0.0 (cli) (built: Nov 30 2020 13:47:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies

Kit version: 2.0.0 Operating system: macOS 10.15.7

ejunker commented 3 years ago

I also got this same error message. I am running version 2.0.0 on macOS.

tmdh commented 3 years ago

There may be multiple php installations in your system. Remove old ones if you can or see if there is any environment variable path precedence issues. I'll add the ability to choose custom PHP executable in the next release.

crossworth commented 3 years ago

I think OSX comes with PHP bundled, I dont think is a path variable issue, otherwise the terminal would be returning the wrong version as well.

PHP installed with homebrew is at (version which I use):

PHP bundled is at:

Content of /etc/paths:

❯ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Changing the path variable or /etc/paths file don't work.

The path that Laravel Kit uses: image

My path: image

Maybe is related to this issue: https://stackoverflow.com/questions/62067127/path-variables-empty-in-electron

tmdh commented 3 years ago

I think this should do the work.

if (process.platform === "darwin") {
  process.env.PATH = ["/usr/local/bin", process.env.PATH].join(":");
}

Unfortunately, I can't test this because I don't have a mac.

SamuelNitsche commented 3 years ago

Not really. I have a m1 mac and php is located somewhere else. I think using this package makes more sense.

https://www.npmjs.com/package/fix-path

tmdh commented 3 years ago

This package has a webpack bug saying it can't resolve a module. The dependencies are outdated. I need to fork this and fix the bugs.

SamuelNitsche commented 3 years ago

I just built the app from source using the latest code and now it works fine for me.

tmdh commented 3 years ago

Fixed in v2.0.1