Search code examples
laravelubuntuputty

Laravel ErrorException No such file or directory


I have uploaded my Laravel project on ubuntu server via putty terminal. Composer installed on server machine but when i run any artisan command it gives an error.

$ php artisan serve
     ErrorException
    
      require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory

The api.php is already there but i don't know why this error comes. Tried all the solutions from google.


Solution

  • Problem:


    You may have changed something earlier such as the name or the path of the file.

    Solution:


    First of all, you use the following command to clear all configs.

    $ php artisan config:clear
    

    Then, you run again the following command.

    $ php artisan serve
    

    Update (2021/01/07):

    You got the following error:

    ErrorException require(/var/www/html/healthapi.fynity.in/routes/api/v1/api.php): failed to open stream: No such file or directory at vendor/laravel/framework/src/Illuminate/Routing/RouteFileRegistrar.php:35 31
    

    It seems that the library is not fully installed. You should update the library with the following command:

    $ composer update
    

    Then, you run again the following command:

    $ php artisan serve