跳转到主要内容
你行网

Main navigation

  • 首页
  • Drupal
  • 编程与开发
  • 数据库
  • 操作系统与应用
  • 服务器与运维
  • 社区
User account menu
  • 登录

面包屑

  1. 首页

ddev 安装drush 错误和解决方案

由 hrs, 25 三月, 2026

错误信息如下:

hrs@hrs-desktop:~/drupal$ ddev composer require drush/drush
./composer.json has been updated
Running composer update drush/drush
> Drupal\Composer\Composer::ensureComposerVersion
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Root composer.json requires drupal/core 12.x-dev -> satisfiable by drupal/core[12.x-dev (alias of dev-main)].
    - Root composer.json requires drush/drush * -> satisfiable by drush/drush[dev-cim-module-install-req, ..., dev-php8, 6.0.0-rc1, ..., 6.x-dev, 7.0.0-alpha1, ..., 7.x-dev, 8.0.0-beta11, ..., 8.x-dev, 9.0.0-alpha1, ..., 9.x-dev, 10.0.0-alpha1, ..., 10.x-dev, 11.0.0-rc1, ..., 11.x-dev, 12.0.0-beta1, ..., 12.x-dev, 13.0.0-beta1, ..., 13.x-dev, 14.x-dev].
    - consolidation/annotated-command[4.10.0, ..., 4.x-dev] require symfony/console ^4.4.8 || ^5 || ^6 || ^7 -> found symfony/console[v4.4.8, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.4.x-dev, v7.0.0-BETA1, ..., 7.4.x-dev] but the package is fixed to v8.0.6 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drupal/core 12.x-dev conflicts with drush/drush <12.4.3.
    - drush/drush[dev-inf-admin, dev-master, dev-greg-1-anderson-robo-2-partII, dev-robo-2, 9.0.0-beta8, ..., 9.x-dev, 10.0.0-alpha1, ..., 10.3.5] require composer/semver ^1.4 -> found composer/semver[1.4.0, ..., 1.x-dev] but the package is fixed to 3.4.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[dev-reenable-cache-commands-testing, ..., dev-php8, 7.2.0, ..., 7.x-dev, 8.0.2, ..., 8.x-dev, 9.0.0-alpha1, ..., 9.0.0-beta7, 10.3.6, ..., 10.x-dev, 11.0.0-rc1, ..., 11.0.5] require psr/log ~1.0 -> found psr/log[1.0.0, ..., 1.1.4] but the package is fixed to 3.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[dev-deprecate-global-config-cmds, dev-ignore-commands-in-parent, dev-no-irc, dev-single-autoloader-only, dev-d10-low-tests, dev-test-74, 11.0.6, ..., 11.x-dev] require symfony/event-dispatcher ^4.0 || ^5.0 || ^6.0 -> found symfony/event-dispatcher[v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev, v6.0.0-BETA1, ..., 6.4.x-dev] but the package is fixed to v8.0.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[dev-cim-module-install-req, dev-cmds-to-static-create, dev-deprecate-io-trait, dev-si-with-recipes-12x, dev-config-check-12.x, dev-weitzman-patch-1, 12.0.0-beta1, ..., 12.x-dev] require symfony/event-dispatcher ^6 -> found symfony/event-dispatcher[v6.0.0-BETA1, ..., 6.4.x-dev] but the package is fixed to v8.0.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[dev-revert-drush-bash-script, dev-requirements-compat, dev-test-on-8.4, dev-chunk/changes-1772775428089-1772775428089, dev-zActions, dev-viz, dev-highest, dev-revert-6192-actions, dev-autowire-params, 13.0.0-beta1, ..., 13.x-dev, 14.x-dev] require symfony/event-dispatcher ^6 || ^7 -> found symfony/event-dispatcher[v6.0.0-BETA1, ..., 6.4.x-dev, v7.0.0-BETA1, ..., 7.4.x-dev] but the package is fixed to v8.0.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[7.0.0-alpha5, ..., 7.1.0, 8.0.0-beta11, ..., 8.0.0-rc2] require symfony/yaml ~2.2 -> found symfony/yaml[v2.2.0, ..., 2.8.x-dev] but the package is fixed to v8.0.6 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[7.0.0-alpha1, ..., 7.0.0-alpha4] require symfony/yaml 2.2.1 -> found symfony/yaml[v2.2.1] but the package is fixed to v8.0.6 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush[8.0.0-rc3, ..., 8.0.1] require symfony/yaml 2.7.* -> found symfony/yaml[v2.7.0-BETA1, ..., 2.7.x-dev] but the package is fixed to v8.0.6 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drush/drush dev-formatting-juggle requires consolidation/output-formatters dev-use-command-directly-of as 4.x-dev -> found consolidation/output-formatters[dev-fields-came-from-default, ..., dev-property-parser, 0.1.0, ..., 0.2.3, 1.0.0-beta1, ..., 1.x-dev, 2.0.0-beta1, ..., 2.1.3, 3.0.0, ..., 3.x-dev, 4.0.0, ..., 4.x-dev] but it does not match the constraint.
    - drush/drush dev-requirements-compat-symfony8 requires consolidation/annotated-command ^4.10.2 -> satisfiable by consolidation/annotated-command[4.10.2, 4.10.3, 4.10.4, 4.x-dev].
    - drush/drush dev-table-empty-message requires consolidation/output-formatters dev-table-empty-message as 4.3.1 -> found consolidation/output-formatters[dev-fields-came-from-default, ..., dev-property-parser, 0.1.0, ..., 0.2.3, 1.0.0-beta1, ..., 1.x-dev, 2.0.0-beta1, ..., 2.1.3, 3.0.0, ..., 3.x-dev, 4.0.0, ..., 4.x-dev] but it does not match the constraint.
    - Conclusion: don't install drupal/core 12.x-dev (conflict analysis result)
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require drush/drush:*" to figure out if any version is installable, or "composer require drush/drush:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
Composer [require drush/drush] failed, composer command failed: exit status 2. stderr=

这个错误是因为 Composer 依赖版本冲突。

你的项目使用的是 Drupal 12.x-dev(需要 Symfony 8 组件),但 Drush 的许多版本要求较旧的 Symfony 组件。

 🔧 解决方案

 方法一:使用 --with-all-dependencies 强制更新(推荐)

 ddev composer require drush/drush --with-all-dependencies 

这会允许 Composer 同时升级或降级其他依赖包以解决冲突。 

方法二:安装支持 Drupal 12 的 Drush 版本 Drush 13 和 14 版本支持更新的 Symfony 组件。

尝试指定版本:

ddev composer require drush/drush:^13 --with-all-dependencies 

或 

 ddev composer require drush/drush:^14 --with-all-dependencies 

方法三:先查看兼容版本 如果不确定哪个版本合适,可以先查看可用的 Drush 版本: 

bash ddev composer show drush/drush --all | grep -E "^versions|^12\." 

📋 关于版本兼容 根据错误信息中的关键点: 

你的 Drupal core 是 12.x-dev Drupal 12 与 drush/drush < 12.4.3 冲突 你当前的 Symfony 组件是 v8.x,需要 Drush 支持 Symfony 6/7/8 的版本 Drush 版本与 Drupal 12 的兼容性: Drush 12.4.3+:部分支持 Drush 13+:完整支持 Drupal 12 Drush 14:最新,支持 Symfony 8

 ✅ 建议执行 

 ddev composer require drush/drush:^14 --with-all-dependencies 

这应该能成功安装与你的 Drupal 12 环境兼容的 Drush 版本。

  • 登录或注册以发表评论
  • 9 次浏览
内容类型分类
drupal cms
文章归类
drupal

文章标签

  • drush

评论

最新文章

  • 内容审核通知 content_moderation_notifications 模块简介
  • 调度程序 scheduler 模块简介
  • 工作流当中的草稿,已发布,很好理解,已归档是怎么理解。
  • 你行网 https://www.dwoke.com seo 关键词
  • brew 是什么命令
  • drupal 9 或 drpal 10 国内内容分享模块 Will Nice social share
  • Views Slideshow - Views Vanilla JavaScript Slideshow (VVJS) 简介和安装方法
  • drupal 11 安装statistics 统计模块
  • drupal11 扩展中找不到Statistics模块
  • drupal11 设置中的“总结摘要”和“切边的” 有什么区别

标签云

adsenseAIapacheaptbadblocksbreadcrumbbrewcentoscertbotckeditorcommandcomposercookiecsharpCSScurlC语言DDEVdiffdnsdockerDreamweaverDrupaldrupal 7drupal 8drupal 9drupal10drupal 11drushExcelfirewalldfirmwareflameshotformgimpgitgzipHTMLHTML5httpdhttp验证inputipjavaJavaScriptJavaSrciptkernelKVMLinuxmavenmbstringmod_expires 模块Mysqlnerdtreenetstatnetworknginxnpmpasswordphpphpmyadminphp扩展RFIDRSSselinuxSEOsharesimple_adsensesshsslStatisticssuperfishsurroundtagcloudstitleubuntuuploadprogressvimVPNVUEWireGuardwpsxdebugyoutubeyumzip主题(theme)二进制五笔分类术语压缩解压哈希值声音字段密码工作流快捷键摄影权限果树种植标签优化模块(module)源地址版本号电子秤电脑基础电脑技巧短信验证端口简介算法网站备份网站运营翻译英语表单视图(views)计算机基础赚钱超五类线网线邮件验证重定向重定向,301错误颜色

相关文章

  • 内容审核通知 content_moderation_notifications 模块简介
  • 调度程序 scheduler 模块简介
  • 工作流当中的草稿,已发布,很好理解,已归档是怎么理解。
  • 你行网 https://www.dwoke.com seo 关键词
  • drupal 9 或 drpal 10 国内内容分享模块 Will Nice social share
  • Views Slideshow - Views Vanilla JavaScript Slideshow (VVJS) 简介和安装方法
  • drupal 11 安装statistics 统计模块
  • drupal11 扩展中找不到Statistics模块
  • drupal11 设置中的“总结摘要”和“切边的” 有什么区别
  • ddev 基本命令中文对照表
RSS源

关于我们

  • 你行网简介
  • 关于我们
  • 版权声明

网站相关

  • 社区论坛
  • 网址导航
  • 网站地图
  • 联系我们

友情链接

  • 英文学习

友情链接2

  • drupal 大学
  • 水滴间
  • 爱码网
  • Apache

友情链接3

  • MySQL
  • php
  • drupalcode

友情链接4

  • Drupal 中国
  • Drupal 老葛
  • 宁浩网
  • drupal 台湾
Copyright © 2019 - 2021 你行网 版权所有  粤ICP备19072650号-1