0
votes

I am trying to install Magento 2 in my localhost, I have also installed composer.

But i am getting the following error:

Fatal error: Class 'Magento\Framework\Autoload\AutoloaderRegistry' not found in C:\xampp\htdocs\magento2\app\autoload.php on line 40

I have goggled but everyone is telling me to install composer. I have also checked whether composer is installed or not using composer -V and i am getting the version of the composer.

I have tried re-installing composer but it shows:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
1

1 Answers

1
votes

Don't have enough rep to comment, so apologies in advance for asking for clarification in an answer.

Can you say where the source code came from and what version you are using? Is this a clone of https://github.com/magento/magento2 ?

There should be a PSR-4 mapping in the composer.json file that helps the composer autoloader find the Framework classes. You should see something like the following in the root composer.json file:

"autoload": {
    "psr-4": {
        "Magento\\Framework\\": "lib/internal/Magento/Framework/"
    }
},

If you open up vendor/composer/autoload_psr4.php you should see a line like the following, if not can you post what you do see?

'Magento\\Framework\\' => array($baseDir . '/lib/internal/Magento/Framework'),

The way app/autoload.php works is by relying on app/etc/vendor_path.php to tell it where your composer vendor directory is, and then using that to include the composer autoload.php file. From there the Magento 2 framework classes should be found as long as the PSR-4 mappings I outlined above exist and are pointing to the proper location.