鍍金池/ 問(wèn)答/PHP/ 安裝laravel時(shí)報(bào)錯(cuò)

安裝laravel時(shí)報(bào)錯(cuò)

新安裝laravel項(xiàng)目時(shí)運(yùn)行下面代碼報(bào)錯(cuò)

composer create-project --prefer-dist laravel/laravel blog

報(bào)錯(cuò)界面:

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.

我也試過(guò)用 laravel new project 的命令去安裝,也是報(bào)同樣的錯(cuò)誤,之前安裝過(guò)是可以的。

請(qǐng)問(wèn)如何解決?

下面是我嘗試過(guò)的方法

我試著去安裝composer-plugin-api:

composer global require composer-plugin-api

再去安裝symfony/thanks

composer global require symfony/thanks

又報(bào)下面錯(cuò)誤了

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"
    }
}

也試過(guò)命令裝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.

報(bào)錯(cuò)找不到版本

回答
編輯回答
選擇

Composer 國(guó)內(nèi)鏡像用了沒(méi) https://pkg.phpcomposer.com/

然后再安裝 laravel 試試

composer global require "laravel/installer"
laravel new blog
2018年7月28日 22:36
編輯回答
夢(mèng)若殤

是不是composer 服務(wù)器沒(méi)有改成國(guó)內(nèi)的鏡像?國(guó)外的被wall了

2018年8月17日 02:19