首页 > 解决方案 > Laravel ErrorException 没有这样的文件或目录

问题描述

我已经通过 putty 终端在 ubuntu 服务器上上传了我的 Laravel 项目。Composer 安装在服务器机器上,但是当我运行任何工匠命令时,它会出错。

$ 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

已经存在,api.php但我不知道为什么会出现这个错误。尝试了谷歌的所有解决方案。

标签: laravelubuntuputty

解决方案


问题:


您之前可能已经更改了某些内容,例如文件的名称或路径。

解决方案:


首先,您使用以下命令清除所有配置。

$ php artisan config:clear

然后,再次运行以下命令。

$ php artisan serve

更新(2021/01/07)

您收到以下错误:

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

似乎该库未完全安装。您应该使用以下命令更新库:

$ composer update

然后,再次运行以下命令:

$ php artisan serve

推荐阅读