laravel11: 安裝時報錯

刘宏缔的架构森林發表於2024-07-10

一,報錯資訊:

[lhdop@blog site]$ composer create-project --prefer-dist laravel/laravel gsapi
Creating a "laravel/laravel" project at "./gsapi"
Installing laravel/laravel (v11.1.1)
  - Downloading laravel/laravel (v11.1.1)
  - Installing laravel/laravel (v11.1.1): Extracting archive
Created project in /data/site/gsapi
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v11.9.0, ..., v11.9.2] require fruitcake/php-cors ^1.3 -> found fruitcake/php-cors[dev-feat-setOptions, 
    dev-master, dev-main, dev-test-8.2, v0.1.0, v0.1.1, v0.1.2, v1.0-alpha1, ..., 1.2.x-dev (alias of dev-master)] 
    but it does not match the constraint.
    - Root composer.json requires laravel/framework ^11.9 -> satisfiable by laravel/framework[v11.9.0, v11.9.1, v11.9.2].

二,原因:

因為composer使用了aliyun映象的原因

安裝composer時執行了命令:

[lhdop@blog ~]$ composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ 

三,解決:

改為使用騰訊雲

composer config -g repo.packagist composer https://mirrors.cloud.tencent.com/composer/

改為騰訊雲後,順利安裝完成

相關文章