Class 'App\Providers\AppServiceProvider' not found - php

I have changed my application by using command
php artisan app:name [app_name].
Then, when I try to perform other actions using following artisan commands,
php artisan down
php artisan up
php artisan config:cache
I got the following error:
PHP Fatal error: Class 'App\Providers\AppServiceProvider' not found
How can I solve it?

It is working after Clearing bootstrap/cache directory.

This is how its worked out for me in the case of a fresh install.
First, I cleared the files in boostrap\cache.
Then, in config\app.php, I added the below line in the providers,
\Laravel\Telescope\TelescopeServiceProvider::class,
Then I ran the below commands
php artisan telescope:install
php artisan migrate
And it was working after this.
I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.
By the way my laravel version was 7.12.0.

In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.
I solved it by removing the line from the file and running composer install.

You might have deleted the folder called providers
App/providers.

I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked

I had the same issue, I solved it by,
migrate migration file - vendor>laravel>telescope>database>- manually.
check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist
Run in command shell>
npm run dev

Related

Class 'RainLab\Blog\Classes\TagProcessor' not found

I'm working with octobercms, when I run php artisan command on working directory. I'm getting the following error
Please anyone tell me how to resolve this issue?
Just update the RainLab.Blog plugin in your project. If not will not work then delete directory this plugin from your project and install again this plugin.
run following commands this will solve your problem.
php artisan dump-autoload
php artisan optimize:clear

'In Container.php Class view does not exist', after running make:migration - Laravel 5.7

I've been trawling for almost two days to find an answer, but no solutions to similar problems have helped to solve mine, so time to ask my own question.
Using Laravel 5.7 on Windows 10. When I run a php artisan make:migration command, or make a model with a migration (make:model -m), it runs fine once; the migration is created. But after that I am unable to run any further php artisan commands. Every time I try I get:
In Container.php line 779:
Class view does not exist
I've since discovered that the same issue also arises when making a seeder. I have noticed that upon running the first command, the bootstrap\cache\services.php file is being removed. Using a backup to replace this file in the directory fixes the problem, allowing me to run php artisan commands again. But the moment I make a migration or a seeder, the file is removed and I encounter the same error.
I have tried a composer dump-autoload. If the services.php file is in the directory, it gets removed again and I am shown the error.
I have tried composer update and composer install (including after removing the vendor folder)
I have tried php artisan config:cache and php artisan config:clear
I have checked my .env file for spaces not contained within quotations.
I have checked that 'Illuminate\View\ViewServiceProvider::class,' is in my config\app.php file under 'providers'.
Everything seemed to be working fine a week or so ago. I hadn't been running any php artisan commands in the interim or really working directly with my application at all during that time so I am not sure what has caused this issue to arise.
make sure to run this command:
sudo chmod 777 -R bootstrap/cache

Laravel clear package auto-discovery cache of composer packages

I wanted to remove a package from laravel. I did composer remove vendor/package
It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.
when I run
php artisan package:discover
I'm geting
In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
I'm guessing I it is something to do with some kind of cache or maby config
but I cannot run this command,
php artisan config:clear
because I'm getting the same error message as above.
PS. I'm using Laravel 5.6
You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.
Remove the following files and they will rebuild:
/bootstrap/cache/packages.php
/bootstrap/cache/services.php
I fixed my problem deleting a config file like so:
$rm bootstrap/cache/config.php
This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:
$php artisan config:cache

Laravel 5.6 Upgrade caused Logging to break

Heey!
So I've recently been given the task to take a Laravel 5.2 up to 5.6. It seemed to be fine...until I tried to do a \Log::info(). Every time I run that, I get a big error, but at the end, it still prints to the log. I saw the 5.6 documentation on creating the config/logger.php. I took a fresh copy of it from github. The only thing I did after that was set an env variable for the LOG_CHANNEL to be single. Here's the error I get:
[2018-03-02 08:28:59] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at I:\xampp\htdocs\mtm\vendor\laravel\framework\src\Illuminate\Log\LogManager.php:181)
[ ....
I did a file comparison between Laravel 5.2 and 5.6. I'm not seeing anything that jumps out that would break the Logging functionality.
Has anyone run into this with a Laravel upgrade?
Add this file to your config folder
https://github.com/laravel/laravel/blob/5.6/config/logging.php
and add this to your .env file LOG_CHANNEL=stack
Don't forget to run php artisan config:clear command afterwards.
I was facing the same issue due to upgrade of my laravel version from 5.3 to 5.7. But after search of few mints i found the solution.
You just need to follow the following steps.
create logging.php file inside the config folder.
Copy code from this Official Link of Laravel.
Past this code into your logging.php file.
run this command -- php artisan config:clear
All done. Happy Coding :)
I got the same problem and tried to do everything as you did but not work.
Finally, I've found that it was because of cached config, just clear it and everything will be fine:
php artisan config:clear
I recently had the same error in my development machine (and not in the production one, oddly). In my development machine I have both php 7.1 and php 7.2 installed. Checking with phpinfo(), I discovered that 7.1 was the default version, so I decided to switch to 7.2.
sudo a2dismod php7.1
sudo a2enmod php7.2
sudo systemctl restart apache2
That didn't solve the problem (but maybe was part of it).
After several hours spent on trying everything suggested around the web, I found my solution by:
Checking all the permissions in the storage folder.
In my project folder, clearing all the cache(s) and config(s).
Dumping all composer autoload files.
In detail:
cd your_project_full_path
sudo chmod -R 0775 storage
sudo chown -R www-data:www-data storage
php artisan config:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload
After this, I had no problem any more. Maybe try 0755 as permission for the storage folder. Hope this helps!
use upgrade guide , and add logging.php to your config files.
After two days of some research, I found a solution on Github.
If you are using Laravel 5.5.4 to Laravel 5.6.*, then you can just install and configure the exceptions package by Graham Campbell.
Link: https://github.com/GrahamCampbell/Laravel-Exceptions
This worked perfectly for me on Mac OSX (PHP 7.1.7), Laravel 5.6.22
My initial error:
2018-05-25 14:35:07] laravel.EMERGENCY: Unable to create configured logger.
Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /Users/pro/Sites/metiwave/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
In my case, APP_LOG= was blank in .env file so I saved it as APP_LOG=single and it worked.
I had the same issue, turns out I had accidentally moved the config folder. If you find yourself in the same situation, (probably as embarrassed as I am) move it back to the root folder of your project.
Regards
all right, i got it
take a look at the official library, copy log config configuration code :
link :https://github.com/laravel/laravel/blob/5.6/config/logging.php
create in your project's config directory logging.php file
copy the code in
clear the cache :php artisan config:clear
that's it. keep stomping ...

Laravel 5.5 - Issues creating new project

I'm trying to use Laravel 5.5. I updated my php 7.0 to php 7.1. Even, I update my laravel installer package. But, when I try to do:
laravel new myProject
I get this error:
You made a reference to a non-existent script #php -r
"file_exists('.env') || copy('.env.example', '.env');" You made a
reference to a non-existent script #php artisan key:generate
Illuminate\Foundation\ComposerScripts::postAutoloadDump You made a
reference to a non-existent script #php artisan package:discover
I am using laravel valet and if I go to the browser, when I try myProject.dev is not working. I see this error:
Whoops, looks like something went wrong.
I tried using:
php artisan key:generate
inside my project, but I got that:
[ErrorException]
file_get_contents(/Users/jorgeJimenez/Sites/laravel5-5/.env): failed
to ope n stream
: No such file or directory
I noticed, my laravel 5.4 projects are working. I copied a .env file and I put on my laravel 5.5 projects. After that, I run
php artisan key:generate
and the key was generated and my project in the browser works.
It's supposed, all that process is automatic, but I am not quite sure what is happening.
You can try update your composer:
composer self-update
I had the same problem. Then I found that there was no problem when i created the first project use laravel 5.5. so I clear composer's cache dir. It works well now.
This is because of your Laravel Installer or Composer version. I have faced the same problem and found following 2 different solutions:
Generally you can solve with by running composer global update command and then run composer update command from your project directory. This solution basically updates your installer and then your project.
If still, you have this issue, you need to run composer self-update command first and then run composer update command from your project directory. Here your composer will update and then your project.
Hope this answer will help you.

Categories