valet: Error after upgrading PHP: "Uncaught Error: Call to undefined function Valet\collect()"
I just upgraded my PHP from 7.3 to 7.4, and valet install
gives me this error:
PHP Fatal error: Uncaught Error: Call to undefined function Valet\collect() in /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php:202
Stack trace:
#0 /Users/sully/.composer/vendor/laravel/valet/cli/includes/helpers.php(149): Valet\Configuration->Valet\{closure}(Array)
#1 /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php(205): Valet\tap(Array, Object(Closure))
#2 /Users/sully/.composer/vendor/laravel/valet/cli/includes/facades.php(28): Valet\Configuration->prune()
#3 /Users/sully/.composer/vendor/laravel/valet/cli/valet.php(43): Facade::__callStatic('prune', Array)
#4 {main}
thrown in /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php on line 202
Fatal error: Uncaught Error: Call to undefined function Valet\collect() in /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php:202
Stack trace:
#0 /Users/sully/.composer/vendor/laravel/valet/cli/includes/helpers.php(149): Valet\Configuration->Valet\{closure}(Array)
#1 /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php(205): Valet\tap(Array, Object(Closure))
#2 /Users/sully/.composer/vendor/laravel/valet/cli/includes/facades.php(28): Valet\Configuration->prune()
#3 /Users/sully/.composer/vendor/laravel/valet/cli/valet.php(43): Facade::__callStatic('prune', Array)
#4 {main}
thrown in /Users/sully/.composer/vendor/laravel/valet/cli/Valet/Configuration.php on line 202
I tried removing my global packages and reinstalling them and the issue persists:
rm -rf ~/.composer/vendor ~/.composer/composer.lock && composer global update
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 9
- Comments: 21 (9 by maintainers)
@saleh-mir Three things come up in the responses you posted:
I suggest upgrading composer as they recommend, via:
composer self-update
Particularly, I wonder if the older composer version doesn’t work well with PHP 7.4.
This happens after openssl@1.1 gets upgraded.(I saw it after the 1.1.1f and 1.1.1t updates)
The quickest patch I’ve found is to run this:
There are newer versions of these available. Running
brew upgrade
is recommended.I also see that your
laravel/envoy
version in your global composer.json refers to an older version. This may be telling composer to use older constraints than necessary.composer global update
but given the out-of-date envoy version, and the fact that envoy and valet are the only things in your global composer.json, I suggest the following in your case:and then after Valet is working properly
composer global require laravel/envoy
to put envoy back again.This solved it for me
@drbyte I did everything you said except step 2 and 4. It’s fixed! Thank you!
Yes, but still respecting your current constraints. Adding
--with-all-dependencies
expands the scope somewhat.Shoot, apparently the one makes it problem for me was the
laravel/envoy
, had to do step 5 to get everything back up and runningThanks for this!