win10下的php8.2环境 创建laravel项目报错:Your requirements could not be resolved to an installable set of packages
1. 运行环境
win 10
1). 当前使用的 Laravel 版本?
使用laravel new demo 创建项目,是最新版本
2). 当前使用的 php/php-fpm 版本?
8.2.4 nts
PHP 版本:
php-fpm 版本: 8.2.4
3). 当前系统
win 10
4). 业务环境
开发环境
5). 相关软件版本
还没有到那一步
2. 问题描述?
我首先执行了: composer self-update 到最新版本
然后执行了: composer clear-cache
然后执行了: composer global update laravel/installer
然后执行了:laravel new demo 和 compoer create-project laravel/laravel demo
最后两条执行后都报错以下错误:
F:\PhpstormProjects>composer create-project laravel/laravel sea_wave
Creating a "laravel/laravel" project at "./sea_wave"
Installing laravel/laravel (v10.2.2)
- Downloading laravel/laravel (v10.2.2)
- Installing laravel/laravel (v10.2.2): Extracting archive
Created project in F:\PhpstormProjects\sea_wave
> @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[v10.10.0, ..., v10.12.0] require dragonmantank/cron-expression ^3.3.2 -> found dragonmantank/cron-expression[dev-master, v1.0.0, ..., v1.2.1, v2.0.0, ..., v2.3.1, v3.0.0, ..., v3.3.1] but it does not match the constraint.
- Root composer.json requires laravel/framework ^10.10 -> satisfiable by laravel/framework[v10.10.0, v10.10.1, v10.11.0, v10.12.0].
3. 您期望得到的结果?
期望正常创建项目
4. 您实际得到的结果?
F:\PhpstormProjects>composer create-project laravel/laravel sea_wave
Creating a "laravel/laravel" project at "./sea_wave"
Installing laravel/laravel (v10.2.2)
- Downloading laravel/laravel (v10.2.2)
- Installing laravel/laravel (v10.2.2): Extracting archive
Created project in F:\PhpstormProjects\sea_wave
> @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[v10.10.0, ..., v10.12.0] require dragonmantank/cron-expression ^3.3.2 -> found dragonmantank/cron-expression[dev-master, v1.0.0, ..., v1.2.1, v2.0.0, ..., v2.3.1, v3.0.0, ..., v3.3.1] but it does not match the constraint.
- Root composer.json requires laravel/framework ^10.10 -> satisfiable by laravel/framework[v10.10.0, v10.10.1, v10.11.0, v10.12.0].
他这个意思是无法下载到特定版本,就是最新版本的库。
那么你需要换源。
能有条件,就直接用外网的源,如你不能,composer在国内有好几个大公司搞的镜像,你逐个替换,尝试。应该能搞定。