I have a problem with laravel and I don't know how to fix it for now. Actually I don't know how I face this problem, but will try to explain you what I did and what I tried for now to fix the problem.
I tried composer update and this problem occured.
Now I can not type any command like php artisan make:livewire name or even php artisan --version, everytime when I try to execute commands I receive this error in console
In Container.php line 811:
Target class [view] does not exist.
In Container.php line 809:
Class view does not exist
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Also the information from the log file
[previous exception] [object] (ReflectionException(code: -1): Class view does not exist at /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:809)
[stacktrace]
#0 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(809): ReflectionClass->__construct()
#1 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(691): Illuminate\\Container\\Container->build()
#2 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(796): Illuminate\\Container\\Container->resolve()
#3 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(637): Illuminate\\Foundation\\Application->resolve()
#4 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(781): Illuminate\\Container\\Container->make()
#5 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(1284): Illuminate\\Foundation\\Application->make()
#6 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(198): Illuminate\\Container\\Container->offsetGet()
#7 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance()
#8 /var/www/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#9 /var/www/vendor/beyondcode/helo-laravel/src/HeloLaravelServiceProvider.php(41): Illuminate\\Support\\Facades\\Facade::__callStatic()
#10 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(627): BeyondCode\\HeloLaravel\\HeloLaravelServiceProvider->register()
#11 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register()
#12 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(604): Illuminate\\Foundation\\ProviderRepository->load()
#13 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#14 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap()
#15 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith()
#16 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#17 /var/www/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#18 {main}
"}
Solutions I have been tried till now:
1.Delete vendor folder and type composer install again but at the final stage I received this error again.
2.Delete vendor and composer.lock still without success.
3.Cleaned boostrap/cache/*.php folder and run commands again, but it not worked again.
So any advice how to fix this problem will be appreciated.
Laravel Version: 7
The whole problem was that, another developer had commented line
Illuminate\View\ViewServiceProvider::class, inside config/app.php providers
For me this error occurred after having executed php artisan optimize:clear.
All I had to do to fix it was to execute php artisan view:cache
I solve this problem in my app (Laravel 8, php 7.4 online server) following the steps below:
access my server over ssh
execute this command for the installer composer:
curl -sS https://getcomposer.org/installer | php
change the name of composer.phar for composer. Follow the stpes below:
mkdir ~/bin
mv ~/composer.phar ~/bin/composer
now execute this command for apache PHP
export PATH=$PATH:/var/www/bin
echo 'export PATH=$PATH:/var/www/bin' >> ~/.bashrc
Now test using the command
composer about
Perfect! Now do you need delete your folder VENDOR, and run the command below :
composer update
Voila! try access you application again
One can also run composer install and it could also fix some versions of this error.
Related
I am currently trying to follow this tutorial: https://www.mediawiki.org/wiki/Wikibase/Installation
I have the latest version of both MediaWiki and WikiBase (1.35) I'm currently trying to run the maintenance scripts.
I have installed both Wikibase Repository and Wikibase Client.
When I try to run "php maintenance/update.php" it gives me this error:
Error from line 47 of /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/lib/WikibaseLib.entitytypes.php: Class "Wikibase\DataModel\Entity\ItemId" not found
#0 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(695): require()
#1 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(410): Wikibase\Repo\WikibaseRepo::getDefaultEntityTypes()
#2 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/WikibaseRepo.php(460): Wikibase\Repo\WikibaseRepo::newInstance()
#3 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/extensions/Wikibase/repo/includes/RepoHooks.php(115): Wikibase\Repo\WikibaseRepo::getDefaultInstance()
#4 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookContainer.php(321): Wikibase\Repo\RepoHooks::onSetupAfterCache()
#5 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#6 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/HookContainer/HookRunner.php(3417): MediaWiki\HookContainer\HookContainer->run(string, array)
#7 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/Setup.php(694): MediaWiki\HookContainer\HookRunner->onSetupAfterCache()
#8 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/includes/WebStart.php(89): require_once(string)
#9 /Applications/XAMPP/xamppfiles/htdocs/mywikiname/index.php(44): require(string)
#10 {main}
How can I fix this? I've tried updating Composer and reinstalling it numerous times. If anyone can help, that would be great! :)
I hit the same error, and in my case, it was because my compose.local.json, (copied from composer.local.json-sample,) was pointing to "extensions/example/composer.json" rather than "extensions/Wikibase/composer.json". Fixing this to Wikibase, deleting composer.lock, running composer install --no-dev again, and finally running update.php fixed the issue.
I try to learn laravel and after creating a project with.
i created a new project by typing "laravel new projectname" in cmd, installing composer and node.js, changed in cmd to the project directory and installed composer there and tryed to run "php artisan serve" comand. i got the message "Laravel development server started: http://127.0.0.1:8000"
when i open http://127.0.0.1:8000 i get a 500 Error (not from the browser. the error is from laravel).
I have absolutly no idea what could be wrong. I went by 3 guides for starters and they did not have this problem.
Is there anything i can do ti fix this error?
thank you very much in advance
edit: here is the logfile from storage/logs
[2019-10-12 20:13:12] production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Encryption\\EncryptionServiceProvider.php:44)
[stacktrace]
#0 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\helpers.php(424): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}(NULL)
#1 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Encryption\\EncryptionServiceProvider.php(48): tap(NULL, Object(Closure))
#2 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Encryption\\EncryptionServiceProvider.php(24): Illuminate\\Encryption\\EncryptionServiceProvider->key(Array)
#3 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(800): Illuminate\\Encryption\\EncryptionServiceProvider->Illuminate\\Encryption\\{closure}(Object(Illuminate\\Foundation\\Application), Array)
#4 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(682): Illuminate\\Container\\Container->build(Object(Closure))
#5 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(630): Illuminate\\Container\\Container->resolve('encrypter', Array)
#6 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(768): Illuminate\\Container\\Container->make('encrypter', Array)
#7 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(946): Illuminate\\Foundation\\Application->make('encrypter')
#8 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(874): Illuminate\\Container\\Container->resolveClass(Object(ReflectionParameter))
#9 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(835): Illuminate\\Container\\Container->resolveDependencies(Array)
#10 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(682): Illuminate\\Container\\Container->build('App\\\\Http\\\\Middle...')
#11 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(630): Illuminate\\Container\\Container->resolve('App\\\\Http\\\\Middle...', Array)
#12 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(768): Illuminate\\Container\\Container->make('App\\\\Http\\\\Middle...', Array)
#13 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(215): Illuminate\\Foundation\\Application->make('App\\\\Http\\\\Middle...')
#14 C:\\Users\\Rjinxil\\testproject\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(189): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#15 C:\\Users\\Rjinxil\\testproject\\public\\index.php(60): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response))
#16 C:\\Users\\Rjinxil\\testproject\\server.php(21): require_once('C:\\\\Users\\\\Rjinxi...')
#17 {main}
"}
So close your terminal session and run this command in your CMD:
php artisan key:generate
in the project folder. Make sure you have .env file created. Then serve your application once again.
Try Below steps :
php artisan config:cache
php artisan cache:clear
php artisan key:generate
I'm working on an e-commerce project on Laravel 5.8, but since I accidently ran "laravel new" command on the project's folder I get this error when I'm trying to launch the project on a local server:
Fatal error: Uncaught ReflectionException: Class config does not exist in C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php:788
Stack trace:
0 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(788): ReflectionClass->__construct('config')
1 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build('config')
2 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(615): Illuminate\Container\Container->resolve('config', Array)
3 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(767): Illuminate\Container\Container->make('config', Array)
4 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php(1227): Illuminate\Foundation\Application->make('config')
5 C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Log\LogManager.php(417): Illuminate\Container\C in C:\wamp64\www\e-commerce\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 788"
The error on line 788 refers to that portion of code:
$reflector = new ReflectionClass($concrete)
This happened after I cloned my repo from Github. Now for every project that I try to run on a local server I get this error.
I tried "composer install", "composer update", "composer dump-autoload" but they all give the same error with this line at the end:
"Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255".
I checked the .env file to see if there was a namespace issue too, but there's none of it.
Thank you in advance for your help.
Try to remove de files in:
cd bootstrap/cache/
rm -rf *.php
In this directory are the file that initializes the structure, cache directory that contains structure-generated files for performance optimization, such as files and route cache services.
You may check the following items
Check whether your APP_NAME has space. If space is there, use it in quotes.
Delete everything from bootstrap/cache/ folder.
run composer dump-autoload
Hope it will work
I tried #gulCunha 's answer and it worked.
After that, you have to run composer update in order to create a new composer.lock and php artisan config:cache after that and you should be good to go.
Did you change the .env file,mistakenly I have added a "APP_NAME=aaa aa " with spaces, then checked every where, after that APP_NAME= changed without spaces, now working charm.
I was creating a new Laravel 9 project with composer and got the same error.
Fatal error: Uncaught ReflectionException: Class "config" does not exist in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:875
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(875): ReflectionClass->__construct('config')
#1 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build('config')
#2 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855): Illuminate\Container\Container->resolve('config', Array, true)
#3 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve('config', Array)
#4 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(840): Illuminate\Container\Container->make('config', Array)
#5 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1415): Illuminate\Foundation\Application->make('config')
#6 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(515): Illuminate\Container\Container->offsetGet('config')
#7 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(566): Illuminate\Log\LogManager->getDefaultDriver()
#8 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(119): Illuminate\Log\LogManager->parseDriver(NULL)
#9 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(702): Illuminate\Log\LogManager->driver()
#10 .../vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->log('error', 'substr(): Argum...', Array)
#11 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(367): Illuminate\Foundation\Exceptions\Handler->report(Object(TypeError))
#12 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(TypeError))
#13 .../artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist. in .../vendor/laravel/framework/src/Illuminate/Container/Container.php:877
Stack trace:
#0 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(756): Illuminate\Container\Container->build('config')
#1 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(855): Illuminate\Container\Container->resolve('config', Array, true)
#2 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve('config', Array)
#3 .../vendor/laravel/framework/src/Illuminate/Foundation/Application.php(840): Illuminate\Container\Container->make('config', Array)
#4 .../vendor/laravel/framework/src/Illuminate/Container/Container.php(1415): Illuminate\Foundation\Application->make('config')
#5 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(515): Illuminate\Container\Container->offsetGet('config')
#6 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(566): Illuminate\Log\LogManager->getDefaultDriver()
#7 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(119): Illuminate\Log\LogManager->parseDriver(NULL)
#8 .../vendor/laravel/framework/src/Illuminate/Log/LogManager.php(702): Illuminate\Log\LogManager->driver()
#9 .../vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(274): Illuminate\Log\LogManager->log('error', 'substr(): Argum...', Array)
#10 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(367): Illuminate\Foundation\Exceptions\Handler->report(Object(TypeError))
#11 .../vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Foundation\Console\Kernel->reportException(Object(TypeError))
#12 .../artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 {main}
thrown in .../vendor/laravel/framework/src/Illuminate/Container/Container.php on line 877
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
But this time it was not about the cache. Regardless of what the errors suggest, the problem was actually caused by the following lines found in vendor/vlucas/phpdotenv/src/Util/Str.php
$converted = $encoding === null ?
#\mb_convert_encoding($input, 'UTF-8') :
#\mb_convert_encoding($input, 'UTF-8', $encoding);
It actually occurred as I didn't have Multibyte String enabled when I built my PHP binaries. After rebuilding PHP with --enable-mbstring, the problem went away.
Make sure your .env file is the exact same as in your local environment. Make sure that the values on your .env file don't have spaces. Those that have spaces should be wrapped in quotes
I had a similar problem. Here is how I fixed it.
It started when I installed Toastr in my config/app.php providers.
I had failed to add the trailing ",".
Hence the problem.
Solution:
Check the last package you installed.
Check if you have added it correctly in the service providers.
You should run 'composer update' command, and then 'php artisan optimize' to clear the config cache and routes.
I'm trying to install an existing Laravel project by running a "composer install" command but i'm getting the following errors :
PHP Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Can anyone help me, I am really overwhelmed
Just delete vendor folder and than run composer update command
Try using composer update and composer dump-autoload command
When you run composer install it will look for a lock file and install whatever is contained in it. Check if your composer.lock or run composer update command
Try the following steps:
Remove the vendor folder if already there
Delete the composer.lock file
Run composer install command in the terminal.
centos7.0
laravel 5.1.11
php7.0
"php artisan"
message:
Fatal error: Uncaught ReflectionException: Class log does not exist in /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php:741
Stack trace:
#0 /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php(741): ReflectionClass->__construct('log')
#1 /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build('log', Array)
#2 /home/website/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('log', Array)
#3 /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php(842): Illuminate\Foundation\Application->make('log')
#4 /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php(805): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php(774): Illuminate\Container\Container->getDependencies(Array, Array)
#6 /home/website/vendor/ in /home/website/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 741
The error was thrown because one of the values in the .env file may have spaces.
Just enclosed any values with space in double quotes.
For example let's assume that this is part of your .env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=This Will Cause An Error
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
....
APP_KEY=This Will Cause An Error will cause this issue because it needs to be in quotes like:
APP_KEY="This Will Work"
Also any space after the values may cause the same issue too
In my case the reason for this error was a missing php extension. Since this missing extension raises an error, the logger tries to log it. This exception appears as a result of no 'log' class resolved from the container. I think this is a Laravel bug.
Check your Apache user and file system user first.
Then run the following commands to set file system permissions:
sudo chmod 755 storage -R
sudo chmod 755 vendor -R
sudo chmod 755 bootstrap -R
After you finished changing the file permissions, clean your chache with the following commands:
php artisan config:cache
php artisan cache:clear
php artisan config:clear
This works for me.