未找到“Predis \ Client”类循环

时间:2018-01-04 17:02:48

标签: php laravel composer-php

我尝试了所有答案here,但没有运气。

奇怪的是,如果我只是运行命令composer update,我会得到这个:

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

仅运行php artisan ide-helper:generate给我

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

删除整个vendor目录,然后运行composer install会给我this output

这是我的composer.lock和我的composer.json文件。

运行命令composer require predis/predis也会返回相同的错误:

> 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

你有什么想法吗?

更新

这是一种解决方法,但不是根解决方案。运行:

 composer update --no-scripts

将跳过

"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"
    ],

部分,现在已经足够好了。这确实看起来像laravel-ide-helper的错误,很快就会报告错误。

1 个答案:

答案 0 :(得分:1)

来自laravel-ide-helper自述文件:

  

当您收到有关未找到的类的FatalException时,请检查您的配置(例如....当您不使用它时删除Redis ServiceProvider)

因此,如果您不使用Redis,请从 (defn prime-seq? [n m] (def list ()) (loop [k n] (cond (< k m) (if (prime? k) (def list (conj list k))) ) ) (println list) ) 删除RedisServiceProviderRedis别名。然后使用config/app.php清除配置缓存。