cvc-complex-type.2.4.a:从元素'foo'开始发现无效内容

时间:2014-10-12 07:34:38

标签: php symfony laravel laravel-4

我正在使用laravel 4.2。我的项目在xampp installation上运行,databasemysql/phpmyadmin。 我安装了ide helper plugin from barryvdh。安装插件后,我在vendor/symfony/routing/Symfony/Component/Routing中遇到了一些奇怪的错误。

cvc-complex-type.2.4.a: Invalid content was found starting with element 'foo'. One of '{"http://symfony.com/schema/routing":default, "http://symfony.com/schema/routing":requirement, "http://symfony.com/schema/routing":option}' is expected. nonvalidroute.xml   /laravelProject/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures line 11 XML Problem
cvc-complex-type.2.4.a: Invalid content was found starting with element 'foo'. One of '{"http://symfony.com/schema/routing":import, "http://symfony.com/schema/routing":route}' is expected.    nonvalidnode.xml    /laravelProject/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures line 7  XML Problem
cvc-complex-type.4: Attribute 'id' must appear on element 'route'.  missing_id.xml  /laravelProject/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures line 7  XML Problem
The end-tag for element type "route" must end with a '>' delimiter. nonvalid.xml    /laravelProject/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures line 11 XML Problem

我的composer.json插件看起来像这样:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "require": {
        "laravel/framework": "4.0.*",
        "cartalyst/sentry": "2.0.*",
        "barryvdh/laravel-ide-helper": "1.*",
        "fzaninotto/faker": "1.3.*@dev"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations",
            "app/database/seeds",
            "app/tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "php artisan optimize"
        ],
        "post-update-cmd": [
             "php artisan ide-helper:generate"
        ],       
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "dev"
}

知道为什么我会收到此异常以及如何修复它?

感谢您的回答!

1 个答案:

答案 0 :(得分:1)

您似乎使用的是Laravel 4.0。*而不是4.2。此外,ide-helper应该是“require-dev”而不是“require”,因为它不会在生产中使用,而且只是为你的IDE助手。

我认为一旦修复了Laravel版本并相应地更改了IDE版本,您将在作曲家更新后删除错误。

如果这不起作用,则问题似乎是您的某个Symfony依赖项在错误日志中指定的文件中存在拼写错误(非关闭标记)。您可以尝试解决这些问题,但我确实认为问题在于版本冲突或版本不稳定。

告诉我们您的情况:)