所以作曲家需要 rebing/graphql-laravel 失败

Posted

技术标签:

【中文标题】所以作曲家需要 rebing/graphql-laravel 失败【英文标题】:SO composer require rebing/graphql-laravel fails 【发布时间】:2020-02-10 15:38:43 【问题描述】:

我在尝试通过 composer 安装 rebing/graphql-laravel 时遇到以下问题:

$ composer require rebing/graphql-laravel
Using version ^2.1 for rebing/graphql-laravel
./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 rebing/graphql-laravel ^2.1 -> satisfiable by rebing/graphql-laravel[2.1.0, 2.1.1].
    - Can only install one of: webonyx/graphql-php[v0.12.6, 0.13.x-dev].
    - Can only install one of: webonyx/graphql-php[0.13.x-dev, v0.12.6].
    - Can only install one of: webonyx/graphql-php[0.13.x-dev, v0.12.6].
    - Conclusion: install webonyx/graphql-php 0.13.x-dev
    - Installation request for webonyx/graphql-php 0.12.6 -> satisfiable by webonyx/graphql-php[v0.12.6].


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

有谁知道如何解决这个问题?我需要这个包来制作这个查询解析器:

<?php

namespace App\GraphQL\Queries;

use Closure;
use App\User;
use Rebing\GraphQL\Support\Facades\GraphQL;
use GraphQL\Type\Definition\ResolveInfo;
use GraphQL\Type\Definition\Type;
use Rebing\GraphQL\Support\Query;
use App\Video;


class Premieres extends Query 

    protected $attributes = [
        'name' => 'Premieres query'
    ];

    public function type(): Type 
        return Type::listOf(GraphQL::type('videos'));
    

    public function args(): array 
        return [];
    

    public function resolve($root, array $args, GraphQLContext $context, ResolveInfo $resolveInfo, Closure $getSelectFields) 
        return Video::where('shownOnPremieres', 1);
    

我不知道还有什么方法可以解决这个问题。我需要做一个查询解析器来做一些特定的查询。谢谢!

在尝试了其中一种建议的解决方案后:

$ composer update webonyx/graphql-php rebing/graphql-laravel
Package "rebing/graphql-laravel" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: beyondcode/laravel-dump-server
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: mll-lab/laravel-graphql-playground
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Discovered Package: nuwave/lighthouse
Discovered Package: spatie/laravel-cors
Package manifest generated successfully.

重新运行安装命令:

$ composer require rebing/graphql-laravel -v

Using version ^2.1 for rebing/graphql-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Dependency resolution completed in 0.103 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for rebing/graphql-laravel ^2.1 -> satisfiable by rebing/graphql-laravel[2.1.0, 2.1.1].
    - Can only install one of: webonyx/graphql-php[v0.12.6, 0.13.x-dev].
    - Can only install one of: webonyx/graphql-php[0.13.x-dev, v0.12.6].
    - Can only install one of: webonyx/graphql-php[0.13.x-dev, v0.12.6].
    - Conclusion: install webonyx/graphql-php 0.13.x-dev
    - Installation request for webonyx/graphql-php 0.12.6 -> satisfiable by webonyx/graphql-php[v0.12.6].


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

它失败了!

【问题讨论】:

尝试使用 -v flag 运行 composer 【参考方案1】:

似乎rebing/graphql-laravel 需要webonyx/graphql-php 的版本高于0.13

您的作曲家文件中似乎还需要webonyx/graphql-php,因此您需要更新子依赖项

composer update webonyx/graphql-php rebing/graphql-laravel

【讨论】:

发表在文章中。 如果您通过添加rebing/graphql-laravel: ^2.1 直接编辑您的composer.json,然后重新运行composer update webonyx/graphql-php rebing/graphql-laravel 会得到更好的结果吗? 我已经解决了:"require": "php": "^7.1.3", "fideloper/proxy": "^4.0", "laravel/framework": "^5.8.0", "laravel/tinker": "^1.0", "mll-lab/laravel-graphql-playground": "^1.1.0", "nuwave/lighthouse": "^4.4.2", "spatie/laravel-cors": "^1.6", "webonyx/graphql-php": "^0.13.8", "rebing/graphql-laravel": "2.1.1" , 但现在我遇到了另一个问题:***.com/questions/58404470/…

以上是关于所以作曲家需要 rebing/graphql-laravel 失败的主要内容,如果未能解决你的问题,请参考以下文章

作曲家:找不到命令

如何防止在“作曲家更新”命令时覆盖文件

如何在 laravel 中要求作曲家自动加载器?

使用 ubuntu 16 安装 Magento 2.2 作曲家

gitlab - 作曲家包的 ci

Laravel包的作曲家需要