Laravel Valet - 锁定文件中已弃用的依赖项
Laravel Valet - deprecated dependencies in lock file
在 运行 composer global require laravel/valet
、illuminate/contracts 和 illuminate/container 上锁定到 v5.4.36:
- Locking illuminate/container (v5.4.36)
- Locking illuminate/contracts (v5.4.36)
运行 任何 valet
命令 returns 一长串类似于以下内容的弃用方法:
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.
在我看来,好像 valet 正在锁定这些软件包的弃用版本,导致我收到警告和错误。任何关于如何升级 illuminate/contracts
和 illuminate/container
以停止弃用通知并让代客使用我当前的设置玩球的想法或见解将不胜感激。
版本:
php8.1.1
作曲家 2.1.14
laravel 8
代客 2.18.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
解决了问题。
什么是 st运行ge,它是最近才出现的,尽管我已经使用 PHP 8.x 很长一段时间了。
在 运行 composer global require laravel/valet
、illuminate/contracts 和 illuminate/container 上锁定到 v5.4.36:
- Locking illuminate/container (v5.4.36)
- Locking illuminate/contracts (v5.4.36)
运行 任何 valet
命令 returns 一长串类似于以下内容的弃用方法:
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.
在我看来,好像 valet 正在锁定这些软件包的弃用版本,导致我收到警告和错误。任何关于如何升级 illuminate/contracts
和 illuminate/container
以停止弃用通知并让代客使用我当前的设置玩球的想法或见解将不胜感激。
版本: php8.1.1 作曲家 2.1.14 laravel 8 代客 2.18.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
解决了问题。
什么是 st运行ge,它是最近才出现的,尽管我已经使用 PHP 8.x 很长一段时间了。