lumen-framework: 'ReflectionException' with message 'Class path.storage does not exist'
after run:
php artisan
get this errors:
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class path.storage does not exist' in /Applications/MAMP/htdocs/folder-project/vendor/laravel/framework/src/Illuminate/Container/Container.php:748 Stack trace:
PHP Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Uncaught exception 'ReflectionException' with message 'Class path.storage does not exist' in /Applications/MAMP/htdocs/folder-project/vendor/laravel/framework/src/Illuminate/Container/Container.php:748 Stack trace:
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 27 (3 by maintainers)
In my case (lumen 5.3.3) got fixed by adding following lines right after $app definition in
bootstrap/app.phpfile:This is happening because Illuminate’s helpers are being loaded before Lumen’s.
My autoload_files.php:
This seems to happen when laravel/framework gets required by something, composer wipes out lumens vendor/illuminate files with vendor/laravel/framework (laravel/framework composer.json says replace illuminate.) - this in turn includes illuminate/Foundation/helpers.php
What’s weirder is it seems like we’re beholden to composer and how it scores/sorts autoload_files.php. I managed to get this to load in different (working) orders but I’m not 100% sure how - and frankly don’t have time for this. But that does confirm @bthibault’s issue.
This issue also persists after removing offending packages from composer.json and running composer update. I suspect this is a caching problem with the laravel replace and composer.
These steps seem to fix the issue, at least intermittently: (and may help reproducing the issue!)
rm -rf ~/.composer/cache/laravel/framework),composer updateThis issue still exists in 5.7
If you are running lumen and if any required package uses as a dependency
laravel/frameworkit will fail.Looks like it’s due to asamaru7/eloquent-model-generator-for-lumen.
Consider where
storage_path()is being called from. In my case, it was called from the app’s config file, which was too soon. Moving the call into the app proper fixed this issue for me.This helped me Thanks
Yeah, I also encountered the same problem now.
Lumen 8.x ,there are two
storage_pathhelper functions shown below.I used
composer why laravel/framework, foundappstract/laravel-opcache,removed itcompsoer remove appstract/laravel-opcache(rm -rf vendor/ & composer install) or setpath.storageinbootstrap\app.php=> https://github.com/laravel/lumen-framework/issues/504#issuecomment-269410657Try this:
$app->instance(‘path.config’, app()->getConfigurationPath()); $app->instance(‘path.storage’, app()->storagePath());
Make sure the call to
parent::tearDown()is after your own code - the inverse ofsetUp().