php 编写器更新未运行

iyr7buue  于 2023-04-04  发布在  PHP
关注(0)|答案(4)|浏览(206)

当我在laravel中为任何项目运行composer update时,我都遇到了一个问题。它给予了我这个错误:无法将您的要求解析为一组可安装的程序包。

Problem 1
    - Root composer.json requires php ^7.1.3 but your php version (8.1.0) does not satisfy that requirement.
  Problem 2
    - laravel/framework[v5.7.0, ..., 5.7.x-dev] require php ^7.1.3 -> your php version (8.1.0) does not satisfy that requirement.
    - Root composer.json requires laravel/framework 5.7.* -> satisfiable by laravel/framework[v5.7.0, ..., 5.7.x-dev].

我尝试从composer.json更改它,但仍然不起作用,我还尝试了composer install --ignore-platform-reqs给我其他错误:

Generating optimized autoload files
Class Egulias\EmailValidator\Exception\ExpectedQPair located in C:/laravel/job-portal-website-in-laravel-master/vendor/egulias/email-validator/EmailValidator\Exception\ExpectingQPair.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Deprecation Notice: 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 C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php:1204
Deprecation Notice: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php:1215
Deprecation Notice: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php:1227
Deprecation Notice: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php:1240
> @php artisan package:discover

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 C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 1204

Deprecated: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 1215

Deprecated: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 1227

Deprecated: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 1240

Deprecated: Method ReflectionParameter::getClass() is deprecated in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 833

Deprecated: Method ReflectionParameter::getClass() is deprecated in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 907

Deprecated: Method ReflectionParameter::getClass() is deprecated in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 833

Deprecated: Method ReflectionParameter::getClass() is deprecated in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 907

Deprecated: Return type of Illuminate\Config\Repository::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 C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Config\Repository.php on line 141

Deprecated: Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\laravel\job-portal-website-in-laravel-master\vendor\laravel\framework\src\Illuminate\Config\Repository.php on line 152

Deprecated: Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute shou......ect.

那么你知道我应该如何 Mage 错误吗?2有人能帮忙吗?3?

xzlaal3s

xzlaal3s1#

您的php版本太高(8.1)。Laravel 5.x与php 8不兼容。
您有两个选择:
1.升级你的laravel安装(至少在8.x版本之前遵循指南)
1.降级你的php版本

s6fujrry

s6fujrry2#

你已经升级了你的机器上的php版本。所以,为了让你的laravel应用程序知道我已经升级到了新版本的php,请执行以下操作:
在你的root目录中打开composer.json文件,在require对象中有提到的php版本。将其更改为如下。

"php": "7.1.3|8.0",

如果这不起作用,那么只使用您机器上安装的当前php版本。

"php": "8.0",
6ss1mwsb

6ss1mwsb3#

解决了!!我使用全局 composer 与XAMPP服务器的PHP。

nkoocmlb

nkoocmlb4#

在我的情况下:我的laravel 8.9
我尝试使用^8.8
然后运行composer u
一切OK

相关问题