fruitcake/laravel-cors软件包拒绝安装[关闭]

chhkpiq4  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(586)

已关闭。此问题需要details or clarity。目前不接受回答。
**要改进此问题吗?**通过editing this post添加详细信息并阐明问题。

3天前关闭。
Improve this question
我试图在我的Laravel项目中使用命令composer require fruitcake/laravel-cors安装fruitcake/cors包,但它给了我这个错误,我尝试了很多解决方案,我发现在谷歌和ChatGPT,但没有工作!

Using version ^3.0 for fruitcake/laravel-cors
./composer.json has been updated
Running composer update fruitcake/laravel-cors
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires fruitcake/laravel-cors ^3.0 -> satisfiable by fruitcake/laravel-cors[v3.0.0].
    - fruitcake/laravel-cors v3.0.0 requires illuminate/support ^6|^7|^8|^9 -> found illuminate/support[v6.0.0, ..., v6.20.44, v7.0.0, ..., v7.30.6, v8.0.0, ..., v8.83.27, v9.0.0, ..., v9.52.16] but these were not loaded, likely because it conflicts with another require.

You can also try re-running composer require with an explicit version constraint, e.g. "composer require fruitcake/laravel-cors:*" to figure out if any version is installable, or "composer require fruitcake/laravel-cors:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

字符串
我使用Laravel 10,PHP 8.2.4和Composer 2.2

guicsvcw

guicsvcw1#

fruitcake/laravel-cors包不支持Laravel 10,这就是为什么你会得到一个composer错误。无论如何,Laravel 10内置了CORS。
如果您从未通过Laravel提供的文件(即图像文件)中获得CORS错误,您应该向Apache(.htaccess文件)/ Nginx Config添加CORS头,如下所示:

# apache header
Header set Access-Control-Allow-Origin "*"

字符串

相关问题