當我composer update在 laravel 中運行任何專案時都會遇到問題。它給了我這個錯誤:您的要求無法決議為一組可安裝的軟體包。
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.
所以你知道我應該如何想象這個錯誤嗎?有人可以幫忙嗎???
uj5u.com熱心網友回復:
您的 php 版本太高(8.1)。Laravel 5.x 與 php 8 不兼容。
這里有兩種選擇:
- 升級你的 laravel 安裝(按照指南至少到 8.x 版本)
- 降級你的php版本
uj5u.com熱心網友回復:
您已經升級了機器中的 php 版本。因此,為了讓您的 laravel 應用程式知道我已經升級到更新版本的 php,請執行以下操作,
在您的root目錄中打開composer.json檔案和require物件中提到了 php 版本。將其更改為以下。
"php": "7.1.3|8.0",
如果這不起作用,那么只需使用您機器上安裝的當前 php 版本。
"php": "8.0",
uj5u.com熱心網友回復:
解決了 !!我將全域作曲家與 XAMPP 服務器一起用于 php。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/430037.html
標籤:php 拉拉维尔 天蓝色 码头工人 laravel-5
