新安装laravel项目时运行下面代码报错
composer create-project --prefer-dist laravel/laravel blog
报错界面:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/thanks v1.0.1 requires composer-plugin-api ^1.1 -> no matching package found.
- symfony/thanks v1.0.0 requires composer-plugin-api ^1.1 -> no matching package found.
- Installation request for symfony/thanks ^1.0 -> satisfiable by symfony/thanks[v1.0.0, v1.0.1].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
我也试过用 laravel new project 的命令去安装,也是报同样的错误,之前安装过是可以的。
请问如何解决?
下面是我尝试过的方法
我试着去安装composer-plugin-api:
composer global require composer-plugin-api
再去安装symfony/thanks
composer global require symfony/thanks
又报下面错误了
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/thanks v1.0.1 requires composer-plugin-api ^1.1 -> no matching package found.
- symfony/thanks v1.0.0 requires composer-plugin-api ^1.1 -> no matching package found.
- Installation request for symfony/thanks ^1.0 -> satisfiable by symfony/thanks[v1.0.0, v1.0.1].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
我看了一下配置的composer.json文件
{
"require": {
"composer-plugin-api": "^1.0"
}
}
也试过命令装1.1版本
Problem 1
- The requested package composer-plugin-api could not be found in any version, there may be a typo in the package name.
Problem 2
- The requested package composer-plugin-api could not be found in any version, there may be a typo in the package name.
报错找不到版本
Composer
国内镜像用了没 https://pkg.phpcomposer.com/然后再安装 laravel 试试