迁移时未找到Laravel致命错误类
- 我已经运行了
artisan migrate:reset
. - 我删除了一些迁移文件,因为我不再需要这些表.
- 我先依次运行
composer dump-autoload
和artisan dump-autoload
-
我运行了
artisan migrate
,并且不断收到此错误:
- I've run
artisan migrate:reset
. - I've deleted some of my migration files because I didn't need these tables anymore.
- I ran
composer dump-autoload
followed byartisan dump-autoload
I ran
artisan migrate
and I keep getting this error:
PHP致命错误:在第297行的/vagrant/LaravelBackend/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php中找不到类"Foo"
我试图:
- 再次运行
composer dump-autoload
和artisan dump-autoload
(也使用artisan clear-compiled
) - 删除迁移表并运行
artisan migrate:install
- 删除vendor和composer.lock文件并运行
composer install
-
使用PHPStorm在我的项目中搜索类Foo.没找到任何东西.
- Run again
composer dump-autoload
andartisan dump-autoload
(also usedartisan clear-compiled
) - Remove the migration table and run
artisan migrate:install
- Remove the vendor and composer.lock file and run
composer install
Search within my project with PHPStorm for class Foo. Didn't find anything.
我不断遇到同样的错误.自从我更新到4.2以来,这是我第一次运行它,如果可以的话.我还要寻找什么吗?
I keep getting the same error. It's the first time I run this since I updated to 4.2 if that could be related. Anything else I should be looking for?
我通过
- 删除所有迁移
- 运行
composer dump-autoload
- 将它们一个接一个地添加并运行
php artisan migrate
- 删除导致Laravel引发错误的内容
- 创建新迁移以替换已删除的迁移
- Removing all migration
- Running
composer dump-autoload
- Adding them back one by one and running
php artisan migrate
- Deleting those that caused Laravel to throw an error
- Create new migrations to replace the deleted ones
我不确定为什么能奏效,但我想过去我可能已经修改了这些有问题的迁移的类名.
I'm not sure why that worked but my guess is that I might have modified the class name of these problematic migrations in the past.
我还发现,使用迁移的初始名称(致命错误引发的迁移)重命名迁移同样适用于其中一些.
I also found that renaming the migration with its initial name (The one throwed with the fatal error) also works for some of them.