Patchwork\Utf8\Bootup 导致 Laravel 4 出现问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21151402/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 08:52:57  来源:igfitidea点击:

Patchwork\Utf8\Bootup causing problems with Laravel 4

phplaravellaravel-4composer-php

提问by jamespick

My project has been working fine until recently, when I ran sudo composer self-update. Composer successfully updated but I could no longer migrate (php artisan migrate). This is the error I get:

我的项目一直运行良好,直到最近,当我运行sudo composer self-update. Composer 已成功更新,但我无法再迁移 ( php artisan migrate)。这是我得到的错误:

PHP Fatal error:  Class 'Patchwork\Utf8\Bootup' not found in /Applications/MAMP/htdocs/ThumbsUp/bootstrap/autoload.php on line 46

I have ran composer updateand composer install, and still this error persists. Why would it not be finding this class after the self-update?

我已经运行composer updatecomposer install,但这个错误仍然存​​在。为什么在之后找不到这个类self-update

采纳答案by Monica

I had the same problem, I ran composer dump-autoloador php composer.phar dump-autoloaddepending on your configuration, ran composer update again and it worked.

我遇到了同样的问题,我运行composer dump-autoloadphp composer.phar dump-autoload根据您的配置,再次运行 composer update 并且它起作用了。

回答by Mohamed Azher

I had a similar issue when trying to run composer update and none of the solutions above had worked. It turns out I had 2 require sections in my composer.json which is actually wrong.

我在尝试运行 composer update 时遇到了类似的问题,但上述解决方案均无效。事实证明,我的 composer.json 中有 2 个 require 部分,这实际上是错误的。

"require": {
    "laravel/framework": "4.1.*"
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "stable",
"require": {
    "barryvdh/laravel-ide-helper": "1.*",
    "zizaco/confide": "3.2.x",
    "laravelbook/ardent": "dev-master",
    "zizaco/entrust": "dev-master"
},
"require-dev": {
    "way/generators": "2.*",
    "fzaninotto/faker": "1.3.*@dev"
}

Combining the two as below solved my issue.

将两者结合如下解决了我的问题。

"require": {
    "laravel/framework": "4.1.*",
    "barryvdh/laravel-ide-helper": "1.*",
    "zizaco/confide": "3.2.x",
    "laravelbook/ardent": "dev-master",
    "zizaco/entrust": "dev-master"
},

If you still have a problem, try deleting the composer.lock and the vendor directory and run

如果仍然有问题,请尝试删除 composer.lock 和 vendor 目录并运行

mv ~/.composer/cache ~/.composer/cache.bak

To clear the composer cache and finally run

清除composer缓存并最终运行

sudo composer install

This should solve the issue.

这应该可以解决问题。

回答by Dominic Tancredi

In tracking down this issue, I found it had to do with this in my composer.json:

在追踪这个问题时,我发现它与我的 composer.json 中的这个有关:

"pre-update-cmd": [ "php artisan clear-compiled" ],

"pre-update-cmd": [ "php artisan clear-compiled" ],

My theory is that "clear-compiled" can't work because composer hasn't been updated. Deleting this, and then calling composer updateand then re-adding it fixed my issue.

我的理论是“clear-compiled”无法工作,因为 composer 尚未更新。删除它,然后调用composer update然后重新添加它解决了我的问题。

回答by Kashif Ullah

I just removed composer.lock file and then run composer updateAnd it worked.

我刚刚删除了 composer.lock 文件,然后运行了composer update它。