After attempting to remove and reinstall a package I'm getting this new error when I try to include('vendor/autoload.php');
Fatal error: Uncaught Error: Class >'ComposerAutoloaderInit7b3c839efeba468a3d595a365ceb8e89' not found in >mypath\vendor\autoload.php:7 Stack trace: #0 mypath\mypage.php(2): include() >#1 {main} thrown in mypath\vendor\autoload.php on line 7
I've tried running composer clearcache before and after reinstalling the package. I deleted C:/Users/MyUsername/AppData/Roaming/Composer and even completely uninstalled Composer. After I reinstalled composer and then reinstalled the package, the error message remains.
What am I missing? I feel like it has a hidden cache somewhere that's breaking this.
Your autoloader seems to be on an unfit state.
Just regenerate it.
composer dump-autoload
If this doesn't work (although it should), simply remove the whole vendor directory, and run composer install again.
Clearing composer's cache has no effect on this, since this is only the one used by composer to avoid downloading files all over again, not a project level cache.
Related
I haven't been building applications with laravel in a while, and I'm trying to recall by running the code
composer create-project --prefer-dist laravel/laravel:^7.0 apitestku
at the end of the installation there is an error:
73 package suggestions were added by new dependencies, use composer suggest to see details. Package fzaninotto/faker is abandoned, you
should avoid using it. No replacement was suggested. Package
phpunit/php-token-stream is abandoned, you should avoid using it. No
replacement was suggested.
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
Fatal error: Interface
'Symfony\Component\HttpKernel\HttpKernelInterface' not found in C:\laravel\apitestku\vendor\laravel\framework\src\Illuminate\Foundation\Application.php on line 29
At first I ignored the problem and ran right away php artisan serve and i got the error
Fatal error: Interface
'Symfony\Component\HttpKernel\HttpKernelInterface' not found in C:\laravel\apitestku\vendor\laravel\framework\src\Illuminate\Foundation\Application.php on line 29
again.
what's causing 'Symfony\Component\HttpKernel\HttpKernelInterface' not found?
i try this solution but not working,
i try solution from Github it's same.
and how to fix it?
I have a Laravel/Homestead project that is finally working locally. Now I'm trying to port it over to HostGator and can't get it running due to titled error. I've tried all the suggested solutions to no avail. Including:
composer require laravel/laravel
composer dump-autoload
composer install --no-scripts
composer update
composer update --no-scripts
Nothing works. Same error. If this is a clue, I also tried
php artisan clear-compiled
and get response of
Could not open input file: artisan
I'm about ready to give up on Laravel/Homestead. I've spent countless hours on this framework with nothing but problems to show for it. Would not recommend it to anybody.
You can see the error yourself here:
http://www.tekknow.net/MedAverter/medaverter/
Any suggestions before I throw in the towel?
For the artisan file, the artisan file is not required through includes, you have it in your root project, which is created when you create your Laravel project. Here is the file.
So you need to have that file in your project.
For the missing class, you try to require laravel/laravel but that is not the correct dependency. Again that github repo is a shell for a project, to have Laravel features you need to base of laravel/laravel and include laravel/framework.
Hope this clears up some confusing and can get you on the right track. Secondly you shouldn't port it over, but simply cloning your project and running composer install should be sufficient.
The problem turned out to be two issues.
1. The wrong version of PHP was running. If I ssh'ed into the hostgator server and did
php -v
It showed PHP 5.6.30 even though I had selected Php 7.1 in the cPanel PHP Selector. If I did
tekknow.net/phpinfo.php
it would say I was using 7.1. Called up HostGator tech support and they were able to change it to PHP 7.3.13.
Now if I do:
php artisan clear cache
I no longer get the error about
Parse error: syntax error, unexpected '?' in
/home1/sl1k7f3j/public_html/medaverter/bootstrap/app.php on line 15
which was an error caused by a version of php that doesn't support the ?? operator.
The second problem was a lack of memory issue. If I did
composer update
It would start to work but would fail in about 30 seconds with
Fatal error: Out of memory (allocated 709623808) (tried to allocate
34187559 bytes) in
phar:///opt/cpanel/composer/bin/composer/src/Composer/Json/JsonFile.php
on line 270
The HostGator tech rep could not figure out why that was happening but I got around that issue by manually uploading my local vendor folder to the host server.
Now when I go to http://tekknow.net/medaverter/ it works!
After attempting to remove and reinstall a package I'm getting this new error when I try to include('vendor/autoload.php');
Fatal error: Uncaught Error: Class >'ComposerAutoloaderInit7b3c839efeba468a3d595a365ceb8e89' not found in >mypath\vendor\autoload.php:7 Stack trace: #0 mypath\mypage.php(2): include() >#1 {main} thrown in mypath\vendor\autoload.php on line 7
I've tried running composer clearcache before and after reinstalling the package. I deleted C:/Users/MyUsername/AppData/Roaming/Composer and even completely uninstalled Composer. After I reinstalled composer and then reinstalled the package, the error message remains.
What am I missing? I feel like it has a hidden cache somewhere that's breaking this.
Your autoloader seems to be on an unfit state.
Just regenerate it.
composer dump-autoload
If this doesn't work (although it should), simply remove the whole vendor directory, and run composer install again.
Clearing composer's cache has no effect on this, since this is only the one used by composer to avoid downloading files all over again, not a project level cache.
Two weeks ago I didn't have any problem, but today this appears when I put composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump
PHP Fatal error: Interface 'Psr\Container\ContainerInterface' not found in /opt/lampp/htdocs/nuevodirectorio/ClinicaLaravel/vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php on line 8
Fatal error: Interface 'Psr\Container\ContainerInterface' not found in /opt/lampp/htdocs/nuevodirectorio/ClinicaLaravel/vendor/laravel/framework/src/Illuminate/Contracts/Container/Container.php on line 8
Here is part of the code of Container.php:
<?php
namespace Illuminate\Container;
use Closure;
use Exception;
use ArrayAccess;
use LogicException;
use ReflectionClass;
use ReflectionParameter;
use Illuminate\Support\Arr;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Contracts\Container\Container as ContainerContract;
class Container implements ArrayAccess, ContainerContract
{
...
}
At my job we had the same problem. In our case, there was a psr/container file causing a conflict, but this file was in the composer global cache, so removing the vendor folder alone didn't help us. First we needed to clear the composer cache using this command:
composer clearcache
and then we removed the vendor folder and ran composer install, everything went fine. I hope this solution helps someone.
I had the same issue.
Still investigating, but what I discovered so far is that, running composer install --no-dev [...], I have the package psr/container in vendor/psr/container in vendors, but 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), line missing in vendor/composer/autoload_psr4.php.
For the time being, I fixed it including dev dependencies, until I figure out the real fix.
Me and my coworker are trying to use local git repo for our Laravel project.
I am using Ubuntu, with PHP 5.5.9-1ubuntu4.9, and he is using Debian with PHP 5.4.39.
When I pulled his committed version, I get an error when trying to run composer update:
user#ubuntu:/var/www/frontend$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
PHP Fatal error: Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182
Script php artisan clear-compiled handling the post-install-cmd event returned with an error [RuntimeException]
Error Output: PHP Fatal error: Class 'Illuminate\Support\Arr' not found in /var/www/frontend/vendor/laravel/framework/src/Illuminate/Support/helpers.php on line 182
We have vendor folder on git, since not having it isn't an option for us.
I guess the problem is different php versions. Is there a way of setting up php version manually, so composer gets the right dependencies?
you can set php version in composer.json file in require portion
"require": {
"php": ">=5.3.0",
},
The problem was probably this:
User checked in the project, including the vendor folder.
Later vendor somehow got added to .gitignore
Nobody noticed that new files were not being added to the repo and magic made sure everything still worked as it did :D