PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] Error with Composer Install - could not scan for classes inside a library dependency in /vendor directory

 February 09, 2022     composer-php, laravel, php, symfony     No comments   

Issue

I'm having issues getting composer to install and run laravel.

Currently on Windows, installed php(binary file or xampp) and composer(win installer or CLI). But facing the same issues when i try to do a composer install on a clean/fresh installation of composer

From https://laravel.com/docs/8.x/installation:

Via Laravel Installer
First, download the Laravel installer using Composer:

composer global require laravel/installer

When running this command, composer will create a composer.lock & composer.json file, but it will eventually face this error

Installation failed, deleting ./composer.json.


  [RuntimeException]
  Could not scan for classes inside "C:\Users\username\AppData\Roaming\Composer\vendor/symfony/polyfill-php73/Res
  ources/stubs" which does not appear to be a file nor a folder

This is the stack trace

Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/ClassMapGenerator.php:71
 Composer\Autoload\ClassMapGenerator::createMap() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/AutoloadGenerator.php:395
 Composer\Autoload\AutoloadGenerator->generateClassMap() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/AutoloadGenerator.php:381
 Composer\Autoload\AutoloadGenerator->addClassMapCode() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Autoload/AutoloadGenerator.php:277
 Composer\Autoload\AutoloadGenerator->dump() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:314
 Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/RequireCommand.php:321
 Composer\Command\RequireCommand->doUpdate() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/RequireCommand.php:240
 Composer\Command\RequireCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:310
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/GlobalCommand.php:107
 Composer\Command\GlobalCommand->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:310
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:122
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:63
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:24

I'm trying to set up the development server for an existing laravel project, and when i git clone the source code and do a composer install, i will face this exact same problem.

I've scoured the internet solutions, but none of them worked for me so far.

Things i've tried:

  • Remove cache, Remove vendor directory and install again --> same error
  • Permissions issue --> Don't think this is a case, user is admin
  • Reinstall & Reformatted my computer twice --> same problem

Please help. Thank you.


Solution

I think that some file is corrupted. To solved, you should delete vendor folder and run composer install.

Update:

You should downgrade version of composer, you should use composer self-update 2.0.4



Answered By - Thân LƯƠNG
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing