Open jameswilson opened 4 years ago
Seeing this as well.
Big Sur php 7.4 D8 and D9 project, happening in all.
Also experiencing this issue with the Conosle global package, outside of a the drupal directory. So appears unrelated to the version of drupal and more related to console and the parser.yml file at line:342:
if ($allowOverwrite || !isset($data[$key])) { $data[$key] = $value; } else { throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine); }
Debugging, the value module:download is already set in the $data array to 'mod' causing the error to be thrown when a new alias is trying to override module:download to 'modo'. The original download command is set in: vendor/drupal/console/src/Command/Module/DownloadCommand.php. But searching the code base I can't find where this additional 'module:download' Command is coming from. The only way around this at moment is to comment out line 345 in vendor/symfony/yaml/Parser.php:
// throw new ParseException(sprintf('Duplicate key "%s" detected.', $key), $this->getRealCurrentLineNb() + 1, $this->currentLine);
Not an ideal fix but makes Drupal Console useable.
I'm getting the same issue under Big Sur, Drupal 8 or 9, or just the console.phar outside a project. I also tried the bin in the vendor dir. I can confirm that commenting out line 355 of vendor/symfony/yaml/Parser.php works.
Exactly the same installation works fine under Ubuntu Linux Server 10. However, in both Linux and Big Sur, the console (version 1.9.7) is unbelievably slow. Takes 20 seconds to respond in linux, and over a minute under Big Sur (after patching under Big Sur). Something is seriously wrong.
Fatal error: Uncaught Symfony\Component\Yaml\Exception\ParseException: Duplicate key "module:download" detected at line 56 (near "module:download: modo"). in /Users/fuo/Sites/wwwroot/glyph.dr8.test/vendor/symfony/yaml/Parser.php:355 Stack trace:
Locate the file [project_directory]/console/aliases.yml
* in your environment, open and remove one of the module:download
declaration (I had two of them):
module:download:
- md
...
module:download: # I removed this line
- modo # and this one
You're good to go!
* [project_directory]: in my case is the directory which contains composer.json
.
For me this duplicated key was contained in $HOME/.console/aliases.yml
, so you might also check this location
Issue title
Duplicate key "module:download"
[
console
]Problem/Motivation
Trying to use Drupal Donsole with Drupal 9, results in the following error w/ stack trace:
Why fix this?
There are still valuable console commands that should be able to be run on Drupal 9.
How to reproduce
composer create-project drupal/recommended-project my-project
(currently, this installs to Drupal version 9.0.7)cd my-project && composer require drupal/console
(currently this adds console version dependency as `^1.9)vendor/bin/drupal generate:theme
Known workarounds
None.