Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class 'Composer\InstalledVersions' not found

I am working on a laravel based project. Like everyday, I am trying to hit this command to run my project on server: php artisan serve But I am getting this error:

Class 'Composer\InstalledVersions' not found

I have tried below commands, but they don't seem to work:

composer update
composer update --no-scripts
php artisan optimize
composer dump-autoload
php composer.phar install --prefer-dist
php artisan package:discover --ansi
like image 457
hardik shiyani Avatar asked Oct 31 '25 08:10

hardik shiyani


1 Answers

I also faced same issue when i'm trying to update my composer dependencies. use below commands to overcome this issue.

  1. first you need to update composer version 2.0+

    it works fine after upgrading to Composer 2.0+. Maybe you are using an old version of 1.0+. 'Composer\InstalledVersions' is onl for the Composer 2.0+.

You can use sudo composer self-update --2 to update composer version make sure your composer changes not reflect to your other projects

now you should able to update composer using composer update.

hope this will helps you!!

like image 125
Vatsal Shah Avatar answered Nov 02 '25 23:11

Vatsal Shah