通过composer将核心从8.2更新到8.3


9

我正在尝试将Drupal核心更新到8.3,但遇到了困难。

页面底部是我开始的composer.json文件。

如果我更改“ drupal / core”:“〜8.2” =>“ drupal / core”:“〜8.3”,然后运行,composer update drupal/core --with-dependencies我会收到以下问题,由于执行器中未包含这些问题,我不确定如何解决此问题我在下面包含的.json文件。

Your requirements could not be resolved to an installable set of packages.



   Problem 1
    - drupal/core 8.3.0 requires symfony/psr-http-message-bridge ^1.0 -> satisfiable by symfony/psr-http-message-bridge[1.0.x-dev].
    - drupal/core 8.3.x-dev requires symfony/psr-http-message-bridge ^1.0 -> satisfiable by symfony/psr-http-message-bridge[1.0.x-dev].
    - drupal/core 8.4.x-dev requires symfony/psr-http-message-bridge ^1.0 -> satisfiable by symfony/psr-http-message-bridge[1.0.x-dev].
    - Conclusion: don't install symfony/psr-http-message-bridge 1.0.x-dev
    - Conclusion: don't install drupal/core 8.3.0-rc2
    - Conclusion: don't install drupal/core 8.3.0-rc1
    - Conclusion: don't install drupal/core 8.3.0-beta1
    - Installation request for symfony/psr-http-message-bridge v0.2 -> satisfiable by symfony/psr-http-message-bridge[v0.2].
    - Conclusion: remove symfony/dom-crawler v3.2.6
    - Installation request for drupal/core ~8.3 -> satisfiable by drupal/core[8.3.0, 8.3.0-alpha1, 8.3.0-beta1, 8.3.0-rc1, 8.3.0-rc2, 8.3.x-dev, 8.4.x-dev].
    - Conclusion: don't install symfony/dom-crawler v3.2.6
    - drupal/core 8.3.0-alpha1 requires symfony/dom-crawler >=2.8.13 <3.0 -> satisfiable by symfony/dom-crawler[2.8.x-dev, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19].
    - Can only install one of: symfony/dom-crawler[2.8.x-dev, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.13, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.14, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.15, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.16, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.17, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.18, v3.2.6].
    - Can only install one of: symfony/dom-crawler[v2.8.19, v3.2.6].
    - Installation request for symfony/dom-crawler (locked at v3.2.6) -> satisfiable by symfony/dom-crawler[v3.2.6].

原始的composer.json

{
"name": "drupal/drupal",
"description": "Drupal is an open source content management platform powering millions of websites and applications.",
"type": "project",
"license": "GPL-2.0+",
"require": {
    "drupal/core": "~8.2",
    "drupal/backup_migrate": "4.x-dev",
    "composer/installers": "^1.0.21",
    "wikimedia/composer-merge-plugin": "~1.3",
    "drupal/console": "^1.0",
    "drupal/file_browser": "^1.0@alpha",
    "enyo/dropzone": "4.2.0",
    "desandro/masonry": "3.3.1",
    "desandro/imagesloaded": "3.1.8",
    "drupal/admin_toolbar": "^1.18",
    "drupal/ctools": "^3.0@alpha",
    "drupal/devel": "^1.0@beta",
    "drupal/migrate_tools": "^3.0",
    "drupal/migrate_plus": "^3.0",
    "drupal/media_entity": "^1.6",
    "drupal/media_entity_document": "^1.1",
    "drupal/media_entity_image": "^1.2",
    "drupal/inline_entity_form": "^1.0@beta",
    "drupal/entity_embed": "^1.0@beta",
    "drupal/entity_browser": "^1.0@beta",
    "paquettg/php-html-parser": "^1.7",
    "drupal/better_exposed_filters": "^3.0@alpha",
    "drupal/workbench_access": "^1.0@alpha",
    "drupal/webform": "^5.0@beta",
    "j7mbo/twitter-api-php": "^1.0",
    "nesbot/carbon": "^1.22",
    "Drupal/userprotect": "^1.0",
    "drupal/config_ignore": "^1.2",
    "Drupal/permissions_by_term": "^1.16",
    "Drupal/views_menu_children_filter": "^1.0@alpha",
    "drupal/sitemap": "^1.2",
    "drupal/xmlsitemap": "^1.0@alpha",
    "drupal/simple_sitemap": "^2.8",
    "drupal/redirect": "^1.0@alpha",
    "drupal/metatag": "^1.0",
    "drupal/acl": "^1.0@alpha",
    "drupal/examples": "1.x-dev",
    "drupal/honeypot": "^1.23",
    "drupal/field_collection": "^1.0@alpha",
    "drupal/dropzonejs": "^1.0@alpha",
    "drupal/embed": "^1.0@RC",
    "drupal/pathauto": "^1.0@RC",
    "drupal/rabbit_hole": "^1.0@beta",
    "drupal/entity_reference_display": "^1.0",
    "drupal/field_group": "^1.0@RC",
    "drupal/layouter": "^1.0",
    "drupal/mailsystem": "^4.1",
    "drupal/mimemail": "^1.0@alpha",
    "drupal/permissions_by_term": "^1.17",
    "drupal/content_access": "1.x-dev",
    "drupal/rules": "^3.0@alpha",
    "drupal/smart_trim": "^1.0",
    "drupal/taxonomy_menu": "^3.3",
    "drupal/token": "^1.0@RC",
    "drupal/typed_data": "^1.0@alpha",
    "drupal/video_embed_field": "^1.4",
    "drupal/views_infinite_scroll": "^1.3",
    "drupal/noreferrer": "^1.1",
    "drupal/system_status": "^2.4",
    "drupal/google_analytics": "^2.1"
},
"replace": {

},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
    "preferred-install": "dist",
    "autoloader-suffix": "Drupal8"
},
"extra": {
    "_readme": [
        "By default Drupal loads the autoloader from ./vendor/autoload.php.",
        "To change the autoloader you can edit ./autoload.php."
    ],
    "merge-plugin": {
        "include": [
            "core/composer.json"
        ],
        "recurse": false,
        "replace": false,
        "merge-extra": false
    },
    "installer-paths": {
        "modules/contrib/{$name}": [
            "type:drupal-module"
        ],
        "modules/custom/{$name}": [
            "type:drupal-custom-module"
        ],
        "libraries/{$name}": [
            "type:drupal-library"
        ],
        "profiles/contrib/{$name}": [
            "type:drupal-profile"
        ],
        "themes/contrib/{$name}": [
            "type:drupal-theme"
        ],
        "themes/custom/{$name}": [
            "type:drupal-custom-theme"
        ]
    }
},
"autoload": {
    "psr-4": {
        "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
    }
},
"scripts": {
    "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
    "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
    "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
    "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
},
"dependencies": {
    "backupmigrate/core": "dev-master",
    "psr/log": "dev-master"
},
"repositories": [
    {
        "type": "composer",
        "url":  "https://packages.drupal.org/8"
    },
    {
        "type": "package",
        "package": {
            "name": "desandro/masonry",
            "version": "3.3.1",
            "type": "drupal-library",
            "dist": {
                "url": "https://github.com/desandro/masonry/archive/v3.3.1.zip",
                "type": "zip"
            }
        }
    },
    {
        "type": "package",
        "package": {
            "name": "desandro/imagesloaded",
            "version": "3.1.8",
            "type": "drupal-library",
            "dist": {
                "url": "https://github.com/desandro/imagesloaded/archive/v3.1.8.zip",
                "type": "zip"
            }
        }
    },
    {
        "type": "package",
        "package": {
            "name": "enyo/dropzone",
            "version": "4.2.0",
            "type": "drupal-library",
            "source": {
                "url": "https://github.com/enyo/dropzone",
                "type": "git",
                "reference": "origin/master"
            }
        }
    },
    {
        "type": "vcs",
        "url": "https://github.com/backupmigrate/backup_migrate_core"
    }
]

}


我上周碰到了这个问题,并进行了修复,但不确定100%我所做的事情是正确的(我也使用webflo / drupal-core-strict)。我希望对此有一个明确的答案。
mpdonadio

Answers:


3

与@rreiss相似,我必须删除.lock。这对我有用:

rm -rf vendor && rm -rf docroot/core && rm -rf docroot/modules/contrib && rm -f composer.lock

composer require drupal/core:8.3.1 --update-with-dependencies

第一行对于您的项目可能是唯一的,请在composer.json中查找installer-paths进行确认。


1

刚遇到同样的事情。为了解决这个问题,我备份/删除了/ vendor目录,然后再次运行“ composer update”,因此Composer将重新下载所有依赖项。我认为已安装的依赖项与所需的依赖项不同步。


2
这就是我最终解决类似Composer问题的方式。我觉得这是一个令人沮丧的“解决方案”,因为它感觉像是黑客。如果Composer的目的是管理我的依赖项,那么我确实希望Composer处理此类事情。就目前而言(带有此“修复程序”),Composer似乎更像一个安装我的Drupal依赖项的工具。再次,这感觉就像是一个漫长的hack,因为这应该是对“下载新zip并覆盖现有Drupal安装”方法的一种改进。
RominRonin

1
我也遇到过同样的问题,我还必须删除composer.lock .. drupal.org/node/2836351#comment-12056279
rreiss

1

尝试从8.3.7升级到8.4.0时,我遇到了非常相似的问题。我想我找到了罪魁祸首。

在DOCROOT composer.json文件中,我看到以下几行:

"merge-plugin": {
    "include": [
        "core/composer.json"
    ],
    "recurse": false,
    "replace": false,
    "merge-extra": false
},

因此,这将指导DOCROOT composer.json文件引用该core/composer.json文件,并且还需要这些依赖项。问题是它正在查看当前安装的Drupal版本的依赖关系,而升级后的版本具有新的依赖关系。这造成了我们所看到的冲突。

这是我发现有效的解决方案。它要求删除任何文件或模块。

1)core/composer.json要升级到的Drupal版本的压缩文件中下载文件的副本。

2)在当前安装中,core/composer.json文件替换为刚下载的新版本。

3)使用“ drupal / core:〜8.xx”(无论您要升级到什么)更新DOCROOT composer.json文件。

4)composer update --with-dependencies照常运行。这次,更新应该继续进行。然后应用数据库/实体更新,重建缓存等。

我是Windows用户,肯定是站点构建者,因此,我什至不会尝试发布命令行提示符来在Linux中执行这些操作。而且我不确定这是否是一个“适当的”解决方案,甚至不确定为什么上面的代码会阻止升级,但这对我有用!


0

只是指出,这对于我从8.2.3> 8.3.7进行的核心更新似乎很有效。请注意,我的Drupal 8安装使用以下代码:https : //github.com/drupal-composer/drupal-scaffold 具有以下目录结构:

.git
.gitignore
composer.json
composer.lock
配置
脚本
供应商
网站

  • 将站点置于维护模式:/ admin / config / development / maintenance
  • 在站点的根目录中运行以下命令: rm -rf vendor && rm -rf web/core && rm -f composer.lock
  • 在站点的根目录中运行以下命令: composer require drupal/core:8.3.7 --update-with-dependencies
  • 转到/update.php(或drush updb)并运行更新。它将说有17个要运行。它可能会返回错误,如果是这样,请转至/update.php并再次运行更新(这次它将显示运行的次数更少)。完成后转到主页。
  • 检查站点。
  • 使站点退出维护模式:/ admin / config / development / maintenance
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.