I had originally reported a workaround for a problem installing drush in ddev, it seems this was related to incorrect installation of docker, installing colima solved the problem, this shows the problem is not related to drupal or ddev but environment issues.
It seems the problem is related to incorrect docker installation.
The diff made me wonder if this was something to do with docker installation, then i looked into this in more detail - I was playing with rancher and docker desktop, i noticed the context for kubernetes in docker desktop was set as rancher, but rancher i had uninstall. This prompted me to uninstall docker desktop and install docker and colima. after trying this I was able to do the ddev composer require drush/drush.
I will reachout to the other user who faced this issue and check with him - but thanks for your help @cilefen. I will leave the issue open till then, but aim to close soon.
edited my comment above for readability hope that helps.
here is the output
Running 2.8.1 (2024-10-04 11:31:01) with PHP 8.3.10 on Linux / 6.10.4-linuxkit
Reading ./composer.json (/var/www/html/composer.json)
Loading config file ./composer.json (/var/www/html/composer.json)
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/var/www/html): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/var/www/html): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/var/www/html): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/var/www/html): hg branch
Executing command (/var/www/html): fossil branch list
Executing command (/var/www/html): fossil tag list
Executing command (/var/www/html): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /home/nidash/.composer/composer.json
Reading /var/www/html/vendor/composer/installed.json
Loading plugin Composer\Installers\Plugin (from composer/installers)
Loading plugin PHPCSStandards\Composer\Plugin\Installers\PHPCodeSniffer\Plugin (from dealerdirect/phpcodesniffer-composer-installer)
Loading plugin Http\Discovery\Composer\Plugin (from php-http/discovery)
Loading plugin Drupal\Composer\Plugin\ProjectMessage\MessagePlugin (from drupal/core-project-message)
Loading plugin Drupal\Composer\Plugin\VendorHardening\VendorHardeningPlugin (from drupal/core-vendor-hardening)
Loading plugin PHPStan\ExtensionInstaller\Plugin (from phpstan/extension-installer)
Executing command (/var/www/html/core/): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/var/www/html/core/): git describe --exact-match --tags
Executing command (/var/www/html/core/): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/var/www/html/core/): hg branch
Executing command (/var/www/html/core/): fossil branch list
Executing command (/var/www/html/core/): fossil tag list
Executing command (/var/www/html/core/): svn info --xml
name : drupal/core
descrip. : Drupal is an open source content management platform powering millions of websites and applications.
keywords :
versions : dev-main
type : drupal-core
license : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
homepage :
source : []
dist : [path] core 946773df28ad729a17c4002a6b5740a746b6deb5
names : drupal/core, drupal/core-annotation, drupal/core-assertion, drupal/core-class-finder, drupal/core-datetime, drupal/core-dependency-injection, drupal/core-diff, drupal/core-discovery, drupal/core-event-dispatcher, drupal/core-file-cache, drupal/core-file-security, drupal/core-filesystem, drupal/core-front-matter, drupal/core-gettext, drupal/core-graph, drupal/core-http-foundation, drupal/core-php-storage, drupal/core-plugin, drupal/core-proxy-builder, drupal/core-render, drupal/core-serialization, drupal/core-transliteration, drupal/core-utility, drupal/core-uuid, drupal/core-version
autoload
psr-4
Drupal\Core\ => lib/Drupal/Core
Drupal\Component\ => lib/Drupal/Component
classmap
lib/Drupal.php, lib/Drupal/Component/DependencyInjection/Container.php, lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php, lib/Drupal/Component/FileCache/FileCacheFactory.php, lib/Drupal/Component/Utility/Timer.php, lib/Drupal/Component/Utility/Unicode.php, lib/Drupal/Core/Cache/Cache.php, lib/Drupal/Core/Cache/CacheBackendInterface.php, lib/Drupal/Core/Cache/CacheTagsChecksumInterface.php, lib/Drupal/Core/Cache/CacheTagsChecksumTrait.php, lib/Drupal/Core/Cache/CacheTagsInvalidatorInterface.php, lib/Drupal/Core/Cache/DatabaseBackend.php, lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php, lib/Drupal/Core/Database/Connection.php, lib/Drupal/Core/Database/Database.php, lib/Drupal/Core/Database/StatementInterface.php, lib/Drupal/Core/DependencyInjection/Container.php, lib/Drupal/Core/DrupalKernel.php, lib/Drupal/Core/DrupalKernelInterface.php, lib/Drupal/Core/Installer/InstallerRedirectTrait.php, lib/Drupal/Core/Site/Settings.php, lib/Drupal/Component/Datetime/Time.php
files
requires
ext-date *
ext-dom *
ext-filter *
ext-gd *
ext-hash *
ext-json *
ext-pcre *
ext-pdo *
ext-session *
ext-simplexml *
ext-spl *
ext-tokenizer *
ext-xml *
ext-zlib *
php >=8.3.0
symfony/console ^7.1
symfony/dependency-injection ^7.1
symfony/event-dispatcher ^7.1
symfony/filesystem ^7.1
symfony/finder ^7.1
symfony/http-foundation ^7.1
symfony/http-kernel ^7.1
symfony/mailer ^7.1
symfony/mime ^7.1
symfony/routing ^7.1
symfony/serializer ^7.1
symfony/validator ^7.1
symfony/process ^7.1
symfony/polyfill-iconv ^1.26
symfony/yaml ^7.1
twig/twig ^3.14.0
doctrine/annotations ^2.0
doctrine/lexer ^2.0
guzzlehttp/guzzle ^7.5
guzzlehttp/psr7 ^2.4.5
egulias/email-validator ^3.2.1|^4.0
masterminds/html5 ^2.7
symfony/psr-http-message-bridge ^7.1
composer-runtime-api ^2.1
composer/semver ^3.3
asm89/stack-cors ^2.1
pear/archive_tar ^1.4.14
psr/log ^3.0
mck89/peast ^1.14
sebastian/diff ^4|^5
suggests
ext-zip Needed to extend the plugin.manager.archiver service capability with the handling of files in the ZIP format.
conflicts
drush/drush <12.4.3
replaces
drupal/core-annotation self.version
drupal/core-assertion self.version
drupal/core-class-finder self.version
drupal/core-datetime self.version
drupal/core-dependency-injection self.version
drupal/core-diff self.version
drupal/core-discovery self.version
drupal/core-event-dispatcher self.version
drupal/core-file-cache self.version
drupal/core-file-security self.version
drupal/core-filesystem self.version
drupal/core-front-matter self.version
drupal/core-gettext self.version
drupal/core-graph self.version
drupal/core-http-foundation self.version
drupal/core-php-storage self.version
drupal/core-plugin self.version
drupal/core-proxy-builder self.version
drupal/core-render self.version
drupal/core-serialization self.version
drupal/core-transliteration self.version
drupal/core-utility self.version
drupal/core-uuid self.version
drupal/core-version self.version
I use a MacBook Air 2020 M1 Sonoma 14.6.1, I saw someone report this on slack on the #contrib channel and i was able to replicate it, the workaround was recommended by him too.
ITEM VALUE
DDEV version v1.23.4
architecture arm64
cgo_enabled 0
db ddev/ddev-dbserver-mariadb-10.11:v1.23.4
ddev-ssh-agent ddev/ddev-ssh-agent:v1.23.4
docker 27.2.0
docker-api 1.47
docker-compose v2.29.1
docker-platform docker-desktop
global-ddev-dir /Users/nidash/.ddev
mutagen 0.17.2
os darwin
router ddev/ddev-traefik-router:v1.23.4
web ddev/ddev-webserver:v1.23.4
Thats the one that does not work.
Checked drupal ladder it is not working any more so suggest removing this paragraph from here.
created an issue @ressa - https://www.drupal.org/project/drupal/issues/3480399 🐛 Composer error when installing drush in DDEV local dev env. Active
@ressa: I am using DDEV version 1.23.4, I have prefixed all commands with ddev - I am also attaching a screen recording.
Screen Recording
@rachel_norfolk I am referring to the DDEV install portion and I copied this from the error I got (just tried the steps again and got the same error) and yes not sure why it says drupal/core 1.0.0 that leads me to think it is a composer problem
@ressa, i havent created an issue at this point I don't know if this is a issue with newer version of composer or drupal code base. I came across this solution on the contrib slack channel and thought it would help people who get stuck in the meantime.
Installing drush fails with the composer error:
Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires drupal/core 1.0.0 (exact version match: 1.0.0 or 1.0.0.0), found drupal/core[dev-main] but it does not match the constraint. Problem 2 - Root composer.json requires drupal/core-project-message 1.0.0 (exact version match: 1.0.0 or 1.0.0.0), found drupal/core-project-message[dev-main] but it does not match the constraint. Problem 3 - Root composer.json requires drupal/core-vendor-hardening 1.0.0 (exact version match: 1.0.0 or 1.0.0.0), found drupal/core-vendor-hardening[dev-main] but it does not match the constraint.
Drupal slack user "Juan Olalla" suggested steps are included.