Home » Php » Php Laravel, when running php artisan serve, I get an error

Php Laravel, when running php artisan serve, I get an error

Posted by: admin February 25, 2020 Leave a comment

Questions:

I’m working on a project in php/laravel. I’ve had no issues til, now. When I run the “php artisan serve” command I get the following error message:

In RouteCollection.php line 236:
syntax error, unexpected ‘OPTIONS’ (T_STRING)

I did not change anything here, I did not change the route file, either. I have tried switching branches and I get the same error message. I have tried running “Composer update” command and I get the following error message:

Loading composer repositories with package information
Updating dependencies (including require-dev)
require-dev)
Nothing to install or update
Writing lock file es
Generating optimized autoload filcripts::postAutoloadDumpes -ansi

Illuminate\Foundation\ComposerSver –ansi handling the post-autoload-dumpcripts::postAutoloadDump
@php artisan package:discover –ansi
Script @php artisan package:discover –ansi handling the post-autoload-dump event returned with error code 1load-dump event returned with error code 1

In RouteCollection.php line 236:

syntax error, unexpected ‘OPTIONS’ (T_STRING)

I’m using php 7.1.3 and laravel 5.8.

Any ideas? Quitting php/laravel is not an option either.

How to&Answers:

Compare your version with
github.com/illuminate/routing/blob/5.8/RouteCollection.php , and make
sure there’s no weird line endings to throw it off. – aynber 2 mins
ago

So I followed this suggestion and replace the entire RouteCollection.php file with the contents form github.