Search code examples
javascriptlaravelcomposer-phplaravel-artisan

Laravel 5 Uncaught SyntaxError: Invalid or unexpected token (red dots)


I'm new with Laravel and have installed a new project succesfull. My Laravel project is based on composer(https://laravel.com/docs/5.3/installation#installing-laravel)

Now I get some errors while loading some .js files. The error is known by me and i've searched the whole internet to find a solution for me, because I used composer install instead of vagrant installer.

The error:

�HTTP/1.1 200 OK Host: laravel.dev:8000 Connection: close Content-Type: application/javascript Content-Length: 97163

Laravel javascript red dots

As u can see above, there are red dots in a .js files with some header description in it.

I found many solutions, but all of them are about vagrant (homestead) or apache, but I can't find any of that files in my computer. Of course I have found the apache config file and added the EnableSendfile off , but that doesn't work, because my laravel project runs on php artisan serve.

So is there someone who knows the solution for my situation?


Solution

  • Try to change in ./server.php. May be this will resolve the issue.

    if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
       return false;
    }
    

    to

    if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    ob_end_clean ();
       return false;
    }