I have recently cloned my bitbucket repo and I'm in the process of moving it to a new live directory.
Upon deploying my codebase to the new live directory, I got a "Class not found" error related to the thujohn/twitter package. So I attempted to remove the package altogether by using:
composer remove thujohn/twitter
Unfortunately, I get this error back:
PHP Fatal error: Class 'Thujohn\Twitter\TwitterServiceProvider' not found in /home/forge/hbavault.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 158
PHP Stack trace:
PHP 1. {main}() /home/forge/site.com/artisan:0
PHP 2. require_once() /home/forge/site.com/artisan:30
PHP 3. require() /home/forge/site.com/bootstrap/start.php:67
PHP 4. Illuminate\Foundation\ProviderRepository->load() /home/forge/site.com/vendor/laravel/framework/src/Illuminate/Foundation/start.php:210
PHP 5. Illuminate\Foundation\ProviderRepository->createProvider() /home/forge/site.com/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:82
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Thujohn\\Twitter\\TwitterServiceProvider' not found","file":"\/home\/forge\/site.com\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":158}}
I've removed reference to the package from my composer.json file and under providers and aliases in the config/app.php file
It is also removed from the two places I was using it in my code.
Any ideas as to what else I need to do to eliminate this error and entirely remove the package?
Related
I have PHP 5.4 on a litespeed web server. PHP has been compiled properly with memcached module and we also installed properly memcached library.
In fact the problem suddenly happened without any change at all (server side) when I run the artisan command, I am getting this error:
PHP Fatal error: Class 'Memcached' not found in /laravel/vendor/laravel/framework/src/Illuminate/Cache/MemcachedConnector.php on line 52
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Memcached' not found
I googled the issue but was unable to find a solution. I am using Laravel 5.0.
I edited the app/Http/Routes.php and returned new Memcached and the php object was returned properly...
Any help would be appreciated.
I had the same issue.
Replace in .env file:
From : CACHE_DRIVER=memcached<br/>
To : CACHE_DRIVER=file**
then clear cache : php artisan cache:clear
I'm trying to run composer update on my project on a production server and I keep getting this error:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[ReflectionException]
Class App\Console\Commands\BlockModelsDidNotShowUp does not exist
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Before this I had a permission denied error because of /storage/logs/laravel.log file - I've updated permissions on that file and I keep getting an error from above.
I've tried this, but I don't have bootstrap/cache/compiled.php file.
If you deleted this class, just clear the cache with:
php artisan clear-compiled
Or delete bootstrap/cache/services.php file manually.
I ran config:cache in my Laravel 5.2 application and this error started showing up.
Fatal error: Uncaught ReflectionException: Class log does not exist in F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php:738 Stack trace: #0 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(738): ReflectionClass->__construct('log') #1 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(633): Illuminate\Container\Container->build('log', Array) #2 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array) #3 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(853): Illuminate\Foundation\Application->make('log') #4 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(808): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter)) #5 F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php(7 in F:\xampp\htdocs\news5.2.23\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 738
I looked for many solutions. Nothing worked for me.
My .env file does not have any spaces
I deleted extra packages from my composer.json and ran composer update.
I ran php artisan clear compiled many times.
I looked for errors in my files but could not find any.
I also enabled the mysql extension since I found it somewhere. Then I did a fresh checkout of Laravel 5.2 and now the error is like this.
So, it's not a problem of any config file of mine. Its something else. Any of you have any idea?
Ok , so I solved it. Looks liek I had multiple issues.
In my fresh check out of laravel 5.2, where I was finding error about not having vendor/autoload.php file, I ran in the root directory in command window,
'composer update --no-scripts' , then 'composer update'. That solved the issue.
I also had to enable my mysql extension by editing php.ini file.
Finally, in my existing project, I actually found a problem in config/app.php. I missed a ',' somewhere. And people, laravel is a disgusting debugger. I miss my cakephp more.
It's a laravel 5 issue. Better to use laravel 4 still
Run this command:
php artisan dump-autoload
then composer update
I was trying to publish my new laravel project using Forge+DigitalOcean but I get the error message (We were unable to install a project on your server) due to php artisan optimize command returning Invalid filename provided. error.
So I modified my .env file and set APP_DEBUG to false and tried to run the command locally. I got the following error:
php artisan optimize -v
Generating optimized class loader Compiling common classes
[RuntimeException] Invalid filename provided.
Exception trace: () at /home/bubut/Code/TalalAttendance/vendor/classpreloader/classpreloader/src/ClassPreloader.php:105
ClassPreloader\ClassPreloader->getCode() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:89
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:70
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at
/home/bubut/Code/TalalAttendance/bootstrap/cache/compiled.php:1138
Illuminate\Container\Container->call() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Command/Command.php:258
Symfony\Component\Console\Command\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:827
Symfony\Component\Console\Application->doRunCommand() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:191
Symfony\Component\Console\Application->doRun() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:100
Illuminate\Foundation\Console\Kernel->handle() at
/home/bubut/Code/TalalAttendance/artisan:36
Laravel allows you to specify additional files to be compiled -- generally files that are used on every request in the application.
The file list is specified in /config/compile.php in the files array. If you have specified a file there but it does not exist (or the location is wrong) then artisan will throw that error when trying to compile it.
Same thing happened to me and removing the non-existent file from the list fixed my problem.
Same issue toady, and after debugging in Illuminate\Foundation\Console\OptimizeCommand, I found that some symfony components missing in vendor folder, even with composer install/update command for some reason.
Remove contents under vendor folder, then do composer update to see if missing components back. Or git clone whole project and composer update. Note that composer install will check composer.lock, if it existing and components missing there, issue triggered.
Note: For additional information
If your files are in a folder inside app folder, this is how you should list them.
'files' => [
'app/your_folder_name/file_a.php',
'app/your_folder_name/file_b.php',
'app/your_folder_name/file_c.php',
]
Hope this helps anyone who one to compile their custom functions.
This is basically a problem of moving a laravel package from workbench to vendor, but the solutions in other threads have not worked in this case:
I have a package iateadonut/signup.
I created a fresh laravel installation (laravel_test), and, just for testing sake, I put iateadonut/signup in laravel_test/workbench/.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
Generating optimized class loader
Running for workbench [iateadonut/signup]...
My package is successfully installed.
On a fresh installation of laravel (laravel_test), I then put iateadonut/signup in larael_test/vendor.
I put Iateadonut\Signup\SignupServiceProvider, in the 'providers' array in app.php.
I then run:
/laravel_test> php artisan dump-autoload
and get:
PHP Fatal error: Class 'Iateadonut\Signup\SignupServiceProvider' not found in /var/www/html/laravel_test/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Iateadonut\Signup\SignupServiceProvider' not found","file":"/var/www/html/laravel_test/bootstrap/compiled.php","line":4214}}
Any idea what could be wrong?
Here is a more google friendly version in case someone else is looking for this:
PHP Fatal error: Class 'Vendor\Package\PackageServiceProvider' not found in /var/www/html/laravel/bootstrap/compiled.php on line 4214
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Vender\Package\PackageServiceProvider' not found","file":"/var/www/html/laravel/bootstrap/compiled.php","line":4214}}
Try to remove the the bootstrap/compiled.php file and try your composer dumpautoload again