安装 Laravel 时报错,提示 Your requirements could not be resolved to an installable set of packages ?

新安装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的更新:

composer global update

我试着去安装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版本

composer global require "composer-plugin-api:^1.1"

报错找不到版本

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

  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.

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.

也上网搜过类似的答案,还是解决不了。

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 4

composer create-project laravel/laravel your-project-name --prefer-dist "5.1.*"

6年前 评论

@if1else0 这样是可以了,如果我要laravel new project的命令也可以要怎么配置?

6年前 评论

@JiaHang 请看文档【安装 Laravel】章节

6年前 评论

@if1else0 我之前是配置好了的,用laravel new project命令是可以创建的。因为出了这个问题,laravel new project这个命令也不行了。

6年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!