【问题标题】:Laravel Valet - deprecated dependencies in lock fileLaravel Valet - 锁定文件中已弃用的依赖项
【发布时间】:2021-12-22 01:16:03
【问题描述】:

在运行 composer global require laravel/valet 时,照明/合同和照明/容器被锁定到 v5.4.36:

  - Locking illuminate/container (v5.4.36)
  - Locking illuminate/contracts (v5.4.36)

运行任何valet 命令会返回一长串已弃用的方法,类似于以下内容:

Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/lluismather/.composer/vendor/illuminate/container/Container.php on line 1159
Deprecated: Method ReflectionParameter::getClass() is deprecated in /Users/lluismather/.composer/vendor/illuminate/container/Container.php on line 788

如果我尝试升级这些,我会收到以下错误:

Problem 1
    - Root composer.json requires illuminate/contracts 8.77.1 -> satisfiable by illuminate/contracts[v8.77.1].
    - illuminate/contracts v8.77.1 requires psr/container ^1.0 -> found psr/container[1.0.0, 1.1.0, 1.1.1, 1.1.2] but the package is fixed to 2.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
  Problem 2
    - illuminate/container v5.4.36 requires illuminate/contracts 5.4.* -> found illuminate/contracts[v5.4.0, ..., v5.4.36] but it conflicts with your root composer.json require (8.77.1).
    - laravel/valet v2.18.1 requires illuminate/container ~5.1|^6.0|^7.0|^8.0 -> satisfiable by illuminate/container[v5.4.36].
    - laravel/valet is locked to version v2.18.1 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

在我看来,好像代客锁定了这些软件包的弃用版本,导致我收到警告和错误。对于如何升级 illuminate/contractsilluminate/container 以停止弃用通知并使用我当前的设置让代客玩球的任何想法或见解将不胜感激。

版本: php 8.1.1 作曲家 2.1.14 拉拉维尔 8 代客2.18.1

【问题讨论】:

    标签: php laravel laravel-valet illuminate-container valet


    【解决方案1】:

    我也有同样的问题。似乎当一个包定义了自己的依赖项并列出了多个主要版本选项时,默认情况下使用最低的一个(并锁定),这导致 Valet 使用illuminate/container:^5.4 拖着它自己的依赖项。

    我的解决方案是将 v8 添加到全局 composer.json,例如:

    {
        "require": {
            "illuminate/container": "^8.0",
            "laravel/installer": "^4.0",
            "laravel/valet": "^2.0",
        }
    }
    

    我删除了composer.lock 文件和供应商文件夹并运行另一个composer global update 解决了问题。

    但奇怪的是,尽管我使用 PHP 8.x 已经有一段时间了,但它只是最近才出现。

    【讨论】:

    • 谢谢 mniess,在这里感谢您的帮助 - 为我解决了这个问题。
    猜你喜欢
    • 2023-03-03
    • 2017-09-12
    • 2020-04-02
    • 2021-05-01
    • 2020-01-01
    • 1970-01-01
    • 2018-02-10
    • 2014-07-07
    • 2019-12-11
    相关资源
    最近更新 更多