yii-gii icon indicating copy to clipboard operation
yii-gii copied to clipboard

Project yiisoft/demo failed to add yiisoft/yii-gii

Open RicardoSette opened this issue 2 years ago • 4 comments

What steps will reproduce the problem?

composer create-project yiisoft/demo --prefer-dist --stability=dev composer update composer require --prefer-dist yiisoft/yii-gii

What is the expected result?

run from command line yii with gii

What do you get instead?

% php yii

Fatal error: Uncaught ErrorException: Duplicate key "Yiisoft\Rbac\StorageInterface" in configs:
 - config/packages/yiisoft/yii-gii/$common in /usr/home/dev/yii3/test/vendor/yiisoft/config/src/Config.php:379
Stack trace:
#0 /usr/home/dev/yii3/test/vendor/yiisoft/config/src/Config.php(250): Yiisoft\Config\Config->throwException('Duplicate key "...')
#1 /usr/home/dev/yii3/test/vendor/yiisoft/config/src/Config.php(114): Yiisoft\Config\Config->merge(Array, '', Array, Array)
#2 /usr/home/dev/yii3/test/vendor/yiisoft/config/src/Config.php(82): Yiisoft\Config\Config->buildGroup('console', '/')
#3 /usr/home/dev/yii3/test/src/Runner/ConsoleApplicationRunner.php(50): Yiisoft\Config\Config->get('console')
#4 /usr/home/dev/yii3/test/yii(25): App\Runner\ConsoleApplicationRunner->run()
#5 {main}
  thrown in /usr/home/dev/yii3/test/vendor/yiisoft/config/src/Config.php on line 379

Additional info

Q A
Version 3.0.x-dev
PHP version PHP 8.0.10
Operating system FreeBSD domainName 12.2-RELEASE FreeBSD 12.2-RELEASE r366954 GENERIC amd64

To solve the problem I just commented one line:

% diff -urNa -U10 ../test2/config/packages/merge_plan.php config/packages/merge_plan.php 
--- ../test2/config/packages/merge_plan.php	
+++ config/packages/merge_plan.php	
@@ -86,21 +86,21 @@
         ],
         'console' => [
             '/' => [
                 '$common',
                 'config/console/*.php',
             ],
             'yiisoft/yii-cycle' => [
                 'console.php',
             ],
             'yiisoft/yii-gii' => [
-                '$common',
+//                '$common',
                 'console.php',
             ],
             'yiisoft/translator-extractor' => [
                 'console.php',
             ],
             'yiisoft/yii-console' => [
                 'console.php',
             ],
             'yiisoft/yii-event' => [
                 'console.php',

I believe it is due to the duplication in composer.json:

% grep -B5 -A5 '\$common' vendor/yiisoft/yii-gii/composer.json
            "source-directory": "config"
        },
        "config-plugin": {
            "params": "params.php",
            "console": [
                "$common",
                "console.php"
            ],
            "common": "common.php"
        }
    },

Any other suggestions for fixing the problem? or would this fix be recommended?

RicardoSette avatar Sep 24 '21 13:09 RicardoSette