Composer php 安装失败-尝试使用composer在Drupal8上安装模块

Composer php 安装失败-尝试使用composer在Drupal8上安装模块,composer-php,drupal-8,Composer Php,Drupal 8,因此,对于我尝试在drupal8环境中安装的任何模块,我都会收到相同的错误消息。 我一直在乱翻文件和文件夹,所以我肯定我弄坏了什么 我是否可以在drupal日志文件中查找更多关于错误的帮助,或者是否有人知道此错误的原因 composer require drupal/Astrology Using version ^1.4 for drupal/astrology ./composer.json has been updated Loading composer repositories wit

因此,对于我尝试在drupal8环境中安装的任何模块,我都会收到相同的错误消息。 我一直在乱翻文件和文件夹,所以我肯定我弄坏了什么

我是否可以在drupal日志文件中查找更多关于错误的帮助,或者是否有人知道此错误的原因

composer require drupal/Astrology
Using version ^1.4 for drupal/astrology
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing drupal/astrology (1.4.0): Loading from cache
Package container-interop/container-interop is abandoned, you should avoid using it. Use psr/container instead.
Writing lock file
Generating autoload files
29 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

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

                                            
  [RuntimeException]                        
  does not exist and could not be created.  
                                            
以下是完整的composer.json文件:

{
    "name": "drupal/recommended-project",
    "description": "Project template for Drupal 8 projects with a relocated document root",
    "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"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "drupal/admin_toolbar": "^2.3",
        "drupal/bootstrap_barrio": "^5.1",
        "drupal/coffee": "^1.0",
        "drupal/core-composer-scaffold": "^8.8",
        "drupal/core-project-message": "^8.8",
        "drupal/core-recommended": "^8.8",
        "drupal/devel": "^4.0",
        "drupal/entity_delete": "^1.6",
        "drupal/feeds": "^3.0@alpha",
        "drupal/feeds_tamper": "^2.0@beta",
        "drupal/flexslider_fields": "^2.0",
        "drupal/fontawesome": "^2.17",
        "drupal/gdoc_field": "^1.1",
        "drupal/migrate_plus": "^5.1",
        "drupal/migrate_tools": "^5.0",
        "drupal/migrate_upgrade": "^3.2",
        "drupal/paragraphs": "^1.12",
        "drupal/pathauto": "^1.8",
        "drupal/pdf_reader": "1.x-dev",
        "drupal/superfish": "^1.4",
        "drupal/tablefield": "^2.1",
        "drush/drush": "^10.3"
    },
    "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/recommended-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"
            ]
        }
    }
}
{
“名称”:“drupal/推荐项目”,
“说明”:“Drupal 8项目的项目模板,具有重新定位的文档根”,
“类型”:“项目”,
“许可证”:“GPL-2.0或更高版本”,
“主页”:https://www.drupal.org/project/drupal",
“支持”:{
“文档”:https://www.drupal.org/docs/user_guide/en/index.html",
“聊天”:https://www.drupal.org/node/314178"
},
“存储库”:[
{
“类型”:“作曲家”,
“url”:”https://packages.drupal.org/8"
}
],
“要求”:{
“编写者/安装者”:“^1.2”,
“drupal/admin_工具栏”:“^2.3”,
“drupal/bootstrap_barrio”:“^5.1”,
“drupal/咖啡”:“^1.0”,
“drupal/core composer脚手架”:“^8.8”,
“drupal/core项目消息”:“^8.8”,
“推荐drupal/core”:“^8.8”,
“drupal/devel”:“^4.0”,
“drupal/entity_delete”:“^1.6”,
“drupal/feed”:“^3。0@alpha",
“drupal/feeds\u tamper”:“^2。0@beta",
“drupal/flexslider_字段”:“^2.0”,
“drupal/fontawesome”:“^2.17”,
“drupal/gdoc_字段”:“^1.1”,
“drupal/migrate_plus”:“^5.1”,
“drupal/migrate_工具”:“^5.0”,
“drupal/migrate_升级”:“^3.2”,
“drupal/段落”:“^1.12”,
“drupal/pathauto”:“^1.8”,
“drupal/pdf_阅读器”:“1.x-dev”,
“drupal/superfish”:“^1.4”,
“drupal/tablefield”:“^2.1”,
“drush/drush”:“^10.3”
},
“冲突”:{
“drupal/drupal”:“*”
},
“最小稳定性”:“dev”,
“更喜欢稳定”:对,
“配置”:{
“排序包”:true
},
“额外”:{
“drupal脚手架”:{
“地点”:{
“web根目录”:”
}
},
“安装程序路径”:{
“核心”:[
“类型:drupal核心”
],
“库/{$name}”:[
“类型:drupal库”
],
“模块/contrib/{$name}”:[
“类型:drupal模块”
],
“profiles/contrib/{$name}”:[
“类型:drupal配置文件”
],
“主题/contrib/{$name}”:[
“类型:drupal主题”
],
“drush/Commands/contrib/{$name}”:[
“类型:drupal drush”
],
“模块/自定义/{$name}”:[
“类型:drupal自定义模块”
],
“主题/自定义/{$name}”:[
“类型:drupal自定义主题”
]
},
“drupal核心项目消息”:{
“包含密钥”:[
“主页”,
“支持”
],
“创建项目后cmd消息”:[
"                                                         ",
“祝贺你,你已经安装了Drupal代码库”,
“来自drupal/推荐的项目模板!”,
"                                                         ",
"",
“下一步:”,
“*安装站点:https://www.drupal.org/docs/8/install",
“*阅读用户指南:https://www.drupal.org/docs/user_guide/en/index.html",
“*获得支持:https://www.drupal.org/support",
“*参与Drupal社区:”,
"      https://www.drupal.org/getting-involved",
*删除打印此消息的插件:“,
“编写器删除drupal/core项目消息”
]
}
}
}
谢谢
标记

您的问题有一个简单的解决方案。添加web根文件夹。公平地说,将供应商存储在web文件夹之外是一种很好的做法

下面是您应该如何做的示例(您还可以将web更改为docroot或任何其他您喜欢的内容):


您可能注意到drush命令位于web文件夹之外。与存储构建脚本、服务器挂钩、修补程序等的方式相同。

对于您的问题,有一个简单的解决方案。添加web根文件夹。公平地说,将供应商存储在web文件夹之外是一种很好的做法

下面是您应该如何做的示例(您还可以将web更改为docroot或任何其他您喜欢的内容):


您可能注意到drush命令位于web文件夹之外。以同样的方式存储构建脚本、服务器挂钩、修补程序等。

您可以发布完整的composer.json文件吗?@RadosławHalicki我现在已经添加了这个文件。最初,文档根目录位于“web”文件夹中,但我将其移回了根目录,因此我想知道这是否与此有关。您可以发布完整的composer.json文件吗?@RadosławHalicki我现在已经添加了该文件。最初,文档根目录位于一个“web”文件夹中,但我将其移回了根目录,所以我想知道这是否与它有关。是的,这是有效的(当我在本地运行它时)。我将文件从“web”文件夹移到了根目录,因为在我们的托管服务器上,只有文件在那里时,它才起作用。明天我将提出一个单独的问题,因为我肯定我肯定遗漏了一些简单的问题。这个答案可能应该注意,这些设置是在文档中引用的。为了公平起见,我建议更改服务器设置以使用web根文件夹。这是两个最好的Drupal人质的工作方式-Acquia和Pantheon。如果没有,我会尝试在没有根文件夹的情况下解决它。是的,这很有效(当我在本地运行它时)。我将文件从“web”文件夹移到了根目录,因为在我们的托管服务器上,只有文件在那里时,它才起作用
    "extra": {
    "drupal-scaffold": {
        "locations": {
            "web-root": "./web"
        }
    },
    "installer-paths": {
        "web/core": [
            "type:drupal-core"
        ],
        "web/libraries/{$name}": [
            "type:drupal-library"
        ],
        "web/modules/contrib/{$name}": [
            "type:drupal-module"
        ],
        "web/profiles/contrib/{$name}": [
            "type:drupal-profile"
        ],
        "web/themes/contrib/{$name}": [
            "type:drupal-theme"
        ],
        "drush/Commands/contrib/{$name}": [
            "type:drupal-drush"
        ],
        "web/modules/custom/{$name}": [
            "type:drupal-custom-module"
        ],
        "web/themes/custom/{$name}": [
            "type:drupal-custom-theme"
        ]
    },