找不到包裹 drush/drush

Posted

技术标签:

【中文标题】找不到包裹 drush/drush【英文标题】:Could not find package drush/drush 【发布时间】:2021-11-25 14:17:51 【问题描述】:

我在运行此命令 composer require drush/drush 时遇到问题,但它对我不起作用,我收到以下错误消息:

[InvalidArgumentException] 找不到包 drush/drush。它 然而,通过存储库搜索找到,这表明一致性 存储库的问题。

我正在使用 Drupal 8.9.18,Drush 版本:10.6.1,我的 php 版本是:php7.1.33 我的 composer.json 文件:


    "name": "drupal/legacy-project",
    "description": "Project template for Drupal 8 projects with composer following drupal/drupal layout",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": 
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    ,
    "repositories": 
        "drupal": 
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        ,
        "0": 
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        ,
        "gigyadrupal": 
            "type": "git",
            "url": "https://github.com/gigya/drupal8.git"
        
    ,
    "require": 
        "composer/installers": "^1.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/core-vendor-hardening": "^8.8",
        "drupal/gigya": "^1.7"
    ,
    "conflict": 
        "drupal/drupal": "*"
    ,
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": 
        "sort-packages": true
    ,
    "extra": 
        "drupal-scaffold": 
            "locations": 
                "web-root": "./"
            
        ,
        "installer-paths": 
            "core": [
                "type:drupal-core"
            ],
            "libraries/$name": [
                "type:drupal-library"
            ],
            "modules/contrib/$name": [
                "type:drupal-module"
            ],
            "profiles/contrib/$name": [
                "type:drupal-profile"
            ],
            "themes/contrib/$name": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/$name": [
                "type:drupal-drush"
            ],
            "modules/custom/$name": [
                "type:drupal-custom-module"
            ],
            "themes/custom/$name": [
                "type:drupal-custom-theme"
            ]
        ,
        "drupal-core-project-message": 
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/legacy-project template!               </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        
    

【问题讨论】:

您能否将您的 composer.json 添加到您的问题中?也许以某种方式配置错误。哪个版本的作曲家顺便说一句?也许composer clear-cache 有帮助。 运行 composer clear-cache 后仍然有同样的问题。我刚刚添加了我的 composer.json 文件 【参考方案1】:

您需要有一组可安装的软件包。 drupal/gigya 不存在(不再存在)。你也不应该使用drupal/legacy-project

这是我想出的最好的,虽然这可能没有给你你想要的 Gigya 版本。不确定,试试看。检查更新的respositories 部分和更新的"gigya/gigya-drupal": "*" 包名称,这将始终为您从GitHub 获取最新的master


    "name": "drupal/legacy-project",
    "description": "Project template for Drupal 8 projects with composer following drupal/drupal layout",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "homepage": "https://www.drupal.org/project/drupal",
    "support": 
        "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
        "chat": "https://www.drupal.org/node/314178"
    ,
    "repositories": [
        
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        ,
        
            "type": "vcs",
            "url": "https://github.com/gigya/drupal8"
        
    ],
    "require": 
        "composer/installers": "^1.2",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/core-vendor-hardening": "^8.8",
        "gigya/gigya-drupal": "*"
    ,
    "conflict": 
        "drupal/drupal": "*"
    ,
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": 
        "sort-packages": true
    ,
    "extra": 
        "drupal-scaffold": 
            "locations": 
                "web-root": "./"
            
        ,
        "installer-paths": 
            "core": [
                "type:drupal-core"
            ],
            "libraries/$name": [
                "type:drupal-library"
            ],
            "modules/contrib/$name": [
                "type:drupal-module"
            ],
            "profiles/contrib/$name": [
                "type:drupal-profile"
            ],
            "themes/contrib/$name": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/$name": [
                "type:drupal-drush"
            ],
            "modules/custom/$name": [
                "type:drupal-custom-module"
            ],
            "themes/custom/$name": [
                "type:drupal-custom-theme"
            ]
        ,
        "drupal-core-project-message": 
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/legacy-project template!               </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        
    


【讨论】:

我必须像你一样更改我的 Composer.json 文件吗? @joes – 当然,如果没有,您将无法要求任何软件包。也许只有存储库部分是错误的。不知道它的来历。但感谢乔斯的反对。只是想帮助你。 好的,谢谢。

以上是关于找不到包裹 drush/drush的主要内容,如果未能解决你的问题,请参考以下文章

drupal 8 如何安装 drush 9

找不到包裹***。源中不存在具有此 ID 的包:“Local Nuget”、Microsoft Visual Studio 脱机包、nuget.org

Ubuntu 14.04:找不到包 php7.0-zip

Composer/Packagist 找不到最低稳定性的软件包

包试图添加对GAC中找不到的System.Runtime的引用

在我设备的文件资源管理器中找不到我的应用数据[关闭]