1

When I save new category, I proceed to exception page.

exception 'Magento\Framework\Exception\LocalizedException' with message 'Can't create directory /var/www/html/var/generation/Magento/Catalog/Model/Indexer/Category/Product/.' in /var/www/html/vendor/magento/framework/Code/Generator.php:103 Stack trace:

/var/www/html/vendor/magento/framework/Code/Generator/Autoloader.php(35): Magento\Framework\Code\Generator->generateClass('Magento\Catalog...')

1 [internal function]: Magento\Framework\Code\Generator\Autoloader->load('Magento\Catalog...')

2 [internal function]: spl_autoload_call('Magento\Catalog...') 3 /var/www/html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\Catalog...') 4 /var/www/html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\Catalog...')

5 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(71): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\Catalog...')

6 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\Catalog...', Array) 7

/var/www/html/vendor/magento/framework/Indexer/ActionFactory.php(35): Magento\Framework\ObjectManager\ObjectManager->create('Magento\Catalog...', Array) and more...#0

What is the problem? And how can I resolve it? I use Magento ver. 2.0.0

Naoto
  • 13
  • 3

2 Answers2

0

Your var folder does not have the right permissions.

I suggest you follow the official documentation to set the right permissions on your Magento instance: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-system-perms.html

cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod u+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod u+w {} \;
chmod u+x bin/magento
Raphael at Digital Pianism
  • 70,385
  • 34
  • 188
  • 352
0

Double-check your permissions. I believe this is a common issue for new setups. From root, run the below to amend permissions:

sudo chmod -R 777 var pub

Then clear your cache:

sudo rm -rf var/cache/* var/generation/*

Ref: http://devdocs.magento.com/guides/v2.0/install-gde/prereq/file-sys-perms-over.html

Craig
  • 2,650
  • 3
  • 15
  • 37