composer安装Laravel 11报错:laravel/framework[v11.9.0, …, v11.23.3] require fruitcake/php-cors ^1.3 -> found fruitcake/php-cors[dev-feat-setOptions, dev-master, dev-maincomposer…

我在使用composer安装Laravel 11的时候,遇到如下错误:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/framework[v11.9.0, ..., v11.23.3] 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.23.3].

原因是阿里云composer镜像源中没有fruitcake/php-cors包的最新版。

解决方法是,切换回默认的composer镜像源:

composer config -g --unset repos.packagist

执行composer install就安装成功了,不再报错。

参考

https://github.com/laravel/framework/issues/51201

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注