laravel 安装包时出错(安装失败,正在将 ./composer.json 恢复到其原始内容。)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50878742/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:54:06  来源:igfitidea点击:

Error installing package (Installation failed, reverting ./composer.json to its original content.)

laravel

提问by

I want to install a package with "composer require rpsimao/invoicexpress-api" but it appears an error:

我想安装一个带有“composer require rpsimao/invoicexpress-api”的包,但出现错误:

Using version ^0.5.6 for rpsimao/invoicexpress-api
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for rpsimao/invoicexpress-api ^0.5.6 -> satisfiable by rpsimao/invoicexpress-api[0.5.6].
    - rpsimao/invoicexpress-api 0.5.6 requires laravel/framework 5.4.* -> satisfiable by laravel/framework[5.4.x-dev, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.12, v5.4.13, v5.4.14, v5.4.15, v5.4.16, v5.4.17, v5.4.18, v5.4.19, v5.4.2, v5.4.20, v5.4.21, v5.4.22, v5.4.23, v5.4.24, v5.4.25, v5.4.26, v5.4.27, v5.4.28, v5.4.29, v5.4.3, v5.4.30, v5.4.31, v5.4.32, v5.4.33, v5.4.34, v5.4.35, v5.4.36, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9] but these conflict with your requirements or minimum-stability.


Installation failed, reverting ./composer.json to its original content.

Do you know how to solve that? Im using laravel 5.5, it seems that the package support that version but it appears the error.

你知道如何解决吗?我使用的是laravel 5.5,该包似乎支持该版本,但出现错误。

采纳答案by aimme

even though they said Tested with Laravel 5.5.*it in the readme,composer.json says it requires both

即使他们在自述文件中说用 Laravel 5.5.* 测试过,composer.json 说它需要两者

"laravel/framework": "5.4.*",
"illuminate/support": "5.4.*",

so if the package's composer.json says it should be Laravel 5.4.*. You are using laravel 5.5 so it's incompatible.

所以如果包的 composer.json 说它应该是 Laravel 5.4.*。您使用的是 laravel 5.5,所以它不兼容。

here is the rpsimao/invoicexpress-api composer.jsonfile of tag 0.5.6. see Laravel version

这是标签 0.5.6的 rpsimao/invoicexpress-api composer.json文件。查看 Laravel 版本

{
    "name": "rpsimao/invoicexpress-api",
    "description": "Laravel Package to interact with InvoiceXpress API",
    "type": "library",
    "keywords": [
        "laravel",
        "rpsimao",
        "invoicexpress-api",
        "invoicexpress",
        "api"
    ],
    "homepage": "https://github.com/rpsimao/invoicexpress-api",
    "license": "MIT",
    "authors": [
        {
            "name": "Ricardo Sim?o",
            "email": "[email protected]"
        }
    ],
    "require": {
        "php": "^7.0",
        "guzzlehttp/guzzle": "^6.2.1",
        "guzzlehttp/psr7": "^1.4.1",
        "guzzlehttp/promises": "~1.0",
        "laravel/framework": "5.4.*",
        "illuminate/support": "5.4.*",
        "spatie/array-to-xml": "^2.5"
    },
    "autoload": {
        "psr-4": {
            "rpsimao\InvoiceXpressAPI\": "src/"
        },
        "files":[
            "src/Helpers/invoicexpress-api.php"
        ]
    },
    "require-dev": {
        "phpunit/phpunit": "^6.1",
        "orchestra/testbench": "^3.4"
    },
    "autoload-dev": {
        "psr-4": {
            "rpsimao\InvoiceXpressAPI\Test\": "tests/"
        }
    },
    "extra": {
    "laravel": {
        "providers": [
            "rpsimao\InvoiceXpressAPI\InvoiceXpressAPIServiceProvider"
        ],
        "aliases": {
            "InvoiceXpressClients": "rpsimao\InvoiceXpressAPI\InvoiceXpressAPIFacade"
           }
        }
    }
}

AFTER EDIT

编辑后

So, currently it's not possible to use with Laravel 5.5 as Laravel 5.5 uses PHP >=7.0.0 too, this package uses Laravel 5.4 which uses PHP >=5.6.4.

所以,目前它不能与 Laravel 5.5 一起使用,因为 Laravel 5.5 也使用 PHP >=7.0.0,这个包使用 Laravel 5.4,它使用 PHP >=5.6.4。

回答by DaFois

That package has not been updated to work with laravel 5.5. You can verify its dependency on packagist:

该软件包尚未更新为适用于 laravel 5.5。你可以验证它对 packagist 的依赖:

https://packagist.org/packages/rpsimao/invoicexpress-api#0.5.6

https://packagist.org/packages/rpsimao/invoicexpress-api#0.5.6

Invoicexpress requires laravel/framework: 5.4.*

Invoicexpress 需要 Laravel/框架:5.4.*

Also the dev-master version is not suitable for laravel 5.5

另外 dev-master 版本不适合 laravel 5.5

dev-master 2018-01-10 15:20 UTC requires

guzzlehttp/guzzle:
^6.2.1 guzzlehttp/psr7: ^1.4.1
guzzlehttp/promises: ~1.0
laravel/framework: 5.4.*
illuminate/support: 5.4.*
php: ^7.0
spatie/array-to-xml: ^2.5

dev-master 2018-01-10 15:20 UTC 要求

guzzlehttp/guzzle:
^6.2.1 guzzlehttp/psr7: ^1.4.1
guzzlehttp/promises: ~1.0
laravel/framework: 5.4.*
照明/支持: 5.4.*
php: ^7.0
spatie/array-to-xml: ^2.5

回答by Kalpesh Shinde

It works on ubuntu and must be check laravel set environmental

它适用于 ubuntu,必须检查 laravel 设置环境

$ composer create-project laravel/laravel BlogLaravel "7.*"

for composer and laravel set envrmental path

为作曲家和 Laravel 设置环境路径

$ export PATH="$PATH:$HOME/.composer/vendor/bin"
$ echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
$ source ~/.bashrc