简体   繁体   English

作曲家更新“ PHP警告:意外字符”错误消息Laravel-4

[英]Composer update “PHP Warning: unexpected character” error message Laravel-4

I do not understand where this error is coming from. 我不知道此错误来自何处。 I first noted it after installing a third party package, and thought that was the problem. 我在安装第三方软件包后首先注意到了这一点,并认为这是问题所在。 Uninstalling the package made no difference. 卸载软件包没有影响。 Reverting to an earlier version of Laravel also had no effect. 恢复到Laravel的早期版本也没有任何效果。 (So now I'm back to the current version, 4.2.8.) (所以现在我回到当前版本4.2.8。)

Here is the full error message in response to $ composer update -- the error is repeated 7 times, right after "Generating autoload files": 这是响应$ composer更新的完整错误消息-在“生成自动加载文件”之后,该错误重复了7次:

PHP Warning:  Unexpected character in input:  ' in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php on line 118

This appears to refer to a corrupted piece of code in composer itself, rather than a corrupted file in the Laravel tree. 这似乎是指作曲家本身中的一段损坏的代码,而不是Laravel树中的损坏的文件。 My copy of composer lives in /usr/local/bin and the only file in that directory is composer. 我的composer副本位于/ usr / local / bin中,该目录中的唯一文件是composer。 The warning appears to suggest that composer is a directory, but of course it's not. 该警告似乎表明composer是一个目录,但不是。 There is nothing on line 118 in composer itself. 作曲家本身的第118行没有任何内容。

I have no idea how to fix this, or how important it is, or how to find where the problem is. 我不知道如何解决这个问题,或者它有多重要,或者如何找到问题所在。 Do I need to reinstall composer? 我需要重新安装作曲家吗?

Thanks for any help. 谢谢你的帮助。


In response to a comment asking about whether composer.json is the problem, here's my entire composer.json file. 为了回应有关composer.json是否是问题的评论,这是我的整个composer.json文件。 I can't identify any errors there: 我在那里找不到任何错误:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "laravel/framework": "4.2.*"
},
"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php",
        "app/libraries"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "stable"
}

And here's lines 116-123 from composer.lock -- could the problem be here? 这是composer.lock的116-123行-问题可能在这里吗? :

            "autoload": {
            "psr-0": {
                "Whoops": "src/"
            },
            "classmap": [
                "src/deprecated"
            ]
        },

Thanks. 谢谢。

Problem solved simply by running 只需运行即可解决问题

composer self-update

Thanks much to help from Marwelln and WereWolf. 非常感谢Marwelln和WereWolf的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM