Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to open stream: No such file or directory (Laravel)

I renamed my UsersController.php file to ~UsersController.php for testing purposes and everything was working fine until I renamed it back to UsersController.php and now I'm getting the below error

include(C:\xampp\htdocs\xxx\vendor\composer/../../app/Http/Controllers/~UsersController.php): failed to open stream: No such file or directory

i'm getting the above error when I want submit form to UsersController while I didn't change anything in my route file or views.

like image 568
Ehsan Mousavi Avatar asked Nov 08 '18 07:11

Ehsan Mousavi


3 Answers

Try php artisan config:cache && php artisan config:clear && composer dump-autoload -o

like image 53
Vahe Shak Avatar answered Nov 03 '22 03:11

Vahe Shak


In my case, the problem was with the autoloader loading old deleted files so I just used " composer dump-autoload -o " and it worked

like image 22
Ermiyas Tsegabu Avatar answered Nov 03 '22 04:11

Ermiyas Tsegabu


In my case, the problem was from the internal repository it reads the old path so,
the solution is to use composer update to read the new repository path.

like image 35
Ahmed Sayed Sk Avatar answered Nov 03 '22 05:11

Ahmed Sayed Sk