Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class 'Predis\Client' not found loop

I tried all the answers here, but no luck.

The weird part is that if I simply run the command composer update I get this:

forge@development:~/default$ composer update
Cannot create cache directory /home/forge/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/forge/.composer/cache/files/, or directory is not writable. Proceeding without cache
> php artisan clear-compiled
The compiled class file has been removed.
> php artisan ide-helper:generate


  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'Predis\Client' not found

Running just php artisan ide-helper:generate gives me

  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'Predis\Client' not found

Deleting the entire vendor directory then running composer install gives me this output.

This is my composer.lock and my composer.json files.

Running the command composer require predis/predis also returns the same error:

> php artisan clear-compiled
The compiled class file has been removed.
> php artisan ide-helper:generate


  [Symfony\Component\Debug\Exception\FatalThrowableError]
  Class 'Predis\Client' not found

Do you have any ideas?

Update

This is a work around, but not a root solution. Running:

 composer update --no-scripts

that will skip the

"scripts": {
    "post-install-cmd": [
       ..
    ],
    "pre-update-cmd": [
        "php artisan clear-compiled",
        "php artisan ide-helper:generate",
        "php artisan ide-helper:models -N",
        "php artisan optimize"
    ],

part, which is good enough for now. This indeed seems like a bug with laravel-ide-helper, reporting bug soon.

like image 859
abbood Avatar asked Dec 05 '25 09:12

abbood


1 Answers

From the laravel-ide-helper readme:

When you receive a FatalException about a class that is not found, check your config (for example .... remove Redis ServiceProvider when you don't use it)

So, remove RedisServiceProvider and Redis alias from config/app.php if you don't use Redis. Then clear config cache with php artisan config:clear.

like image 154
Alexey Mezenin Avatar answered Dec 06 '25 23:12

Alexey Mezenin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!