密钥自动加载在第20行的./composer.json中是重复项

时间:2018-10-26 21:27:49

标签: php symfony composer-php autoload psr-4

作曲家更新时出现错误

这是composer.json

 {
        "name": "trigui/symfony",
        "license": "proprietary",
        "type": "project",
        "autoload": {
            "psr-4": {
                "": "src/"
            },
            "classmap": [
                "app/AppKernel.php",
                "app/AppCache.php"
            ]
        },
      "autoload": {
        "psr-4": {
          "": "src/",
          "VotreNamespace": "chemin/vers/la/bibliotheque"
        },
        "files": [ "app/AppKernel.php" ]
      },    
        "autoload-dev": {
            "psr-4": {
                "Tests\\": "tests/"
            },
            "files": [
                "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
            ]
        },
        "require": {
            "php": ">=5.5.9",
            "doctrine/doctrine-bundle": "^1.6",
            "doctrine/orm": "^2.5",
            "incenteev/composer-parameter-handler": "^2.0",
            "sensio/distribution-bundle": "^5.0.19",
            "sensio/framework-extra-bundle": "^3.0.2",
            "symfony/monolog-bundle": "^3.1.0",
            "symfony/polyfill-apcu": "^1.0",
            "symfony/swiftmailer-bundle": "^2.3.10",
            "symfony/symfony": "3.3.*",
            "twig/twig": "^1.0||^2.0",
            "doctrine/doctrine-fixtures-bundle":"~2.3"
        },
        "require-dev": {
            "sensio/generator-bundle": "^3.0",
            "symfony/phpunit-bridge": "^3.0"
        },
            "branch-alias": null
        }
    }

这是错误:

  

密钥自动加载与./composer.json中的第20行重复


  

非空的PSR-4前缀必须以名称空间分隔符结尾。

请问问题是什么?

2 个答案:

答案 0 :(得分:1)

谢谢大家,我已将json更改为@Jorge AugustoMorêrade Moura的答案

我删除了

  

“ VotreNamespace”:“ chemin / vers / la / bibliotheque”

答案 1 :(得分:0)

在第5行和第20行有2个自动加载键。在第48行和第49行有双括号关闭文件末尾

尝试这个json

{
    "name": "trigui/symfony",
    "license": "proprietary",
    "type": "project",
    "autoload": {
        "psr-4": {
            "": "src/",
            "VotreNamespace": "chemin/vers/la/bibliotheque"
        },
        "classmap": [
            "app/AppKernel.php",
            "app/AppCache.php"
        ],
        "files": [ "app/AppKernel.php" ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        },
        "files": [
            "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
        ]
    },
    "require": {
        "php": ">=5.5.9",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/orm": "^2.5",
        "incenteev/composer-parameter-handler": "^2.0",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^3.0.2",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.3.10",
        "symfony/symfony": "3.3.*",
        "twig/twig": "^1.0||^2.0",
        "doctrine/doctrine-fixtures-bundle":"~2.3"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "branch-alias": null
}