Laravel production.ERROR:带有消息“Class cors不存在”的异常“ReflectionException”
在本地,我没有得到错误,但是当我使用Git部署到服务器时,我得到以下错误:Laravel production.ERROR:带有消息“Class cors不存在”的异常“ReflectionException”,laravel,laravel-5,composer-php,autoload,autoloader,Laravel,Laravel 5,Composer Php,Autoload,Autoloader,在本地,我没有得到错误,但是当我使用Git部署到服务器时,我得到以下错误: production.ERROR: exception 'ReflectionException' with message 'Class cors does not exist' in /home/ruben/apps/bootstrap/cache/compiled.php:1244 Stack trace: #0 /home/ruben/apps/bootstrap/cache/compiled.php(1244)
production.ERROR: exception 'ReflectionException' with message 'Class cors does not exist' in /home/ruben/apps/bootstrap/cache/compiled.php:1244
Stack trace:
#0 /home/ruben/apps/bootstrap/cache/compiled.php(1244): ReflectionClass->__construct('cors')
#1 /home/ruben/apps/bootstrap/cache/compiled.php(1195): Illuminate\Container\Container->build('cors', Array)
#2 /home/ruben/apps/bootstrap/cache/compiled.php(1733): Illuminate\Container\Container->make('cors', Array)
#3 /home/ruben/apps/bootstrap/cache/compiled.php(9459): Illuminate\Foundation\Application->make('cors')
#4 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#5 /home/ruben/apps/bootstrap/cache/compiled.php(9449): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#6 /home/ruben/apps/bootstrap/cache/compiled.php(7375): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#7 /home/ruben/apps/bootstrap/cache/compiled.php(7363): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#8 /home/ruben/apps/bootstrap/cache/compiled.php(7348): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#9 /home/ruben/apps/bootstrap/cache/compiled.php(2262): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#10 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#11 /home/ruben/apps/bootstrap/cache/compiled.php(9467): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#12 /home/ruben/apps/bootstrap/cache/compiled.php(2882): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#13 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#14 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#15 /home/ruben/apps/bootstrap/cache/compiled.php(12755): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#16 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#17 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#18 /home/ruben/apps/bootstrap/cache/compiled.php(11390): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#19 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#20 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#21 /home/ruben/apps/bootstrap/cache/compiled.php(12496): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#24 /home/ruben/apps/bootstrap/cache/compiled.php(12435): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#27 /home/ruben/apps/bootstrap/cache/compiled.php(2932): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /home/ruben/apps/bootstrap/cache/compiled.php(9459): call_user_func_array(Array, Array)
#30 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /home/ruben/apps/bootstrap/cache/compiled.php(9449): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#32 /home/ruben/apps/bootstrap/cache/compiled.php(2209): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#33 /home/ruben/apps/bootstrap/cache/compiled.php(2192): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#34 /home/ruben/apps/public/index.php(54): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#35 {main}
我已删除我的/vendor文件夹和composer.lock文件,并再次运行composer安装。我查过了,班级的档案在那里
我希望有人能帮助我
更新
我得到了一些关于区分大小写的提示。我真的不知道如何使用这个技巧,因为我只是使用composer.json来安装软件包。我决定注释掉cors的内容,然后出现了下一个错误:
production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'JWTAuth' not found' in
这是一个类似的错误,我在与Cors类相同的时间添加了一个类。我不明白为什么没有加载这些类。很抱歉,我迟到了,我刚刚解决了它。到您的项目根目录并运行:
composer dump-autoload
您的本地机器可能是windows和生产linux吗?检查是否区分大小写,因为它正在寻找具有小写字母的cors。具体来说,您需要检查类文件的文件名是否与类的名称大小写完全匹配。自动加载程序在名为cors.php的文件中找不到名为cors的类。这似乎是正确的。尽管我真的不知道如何正确地调试它。我刚刚通过composer安装了此软件包: