New to Magento trying to upload Magento 2 CE onto my localhost to learn.
Installed XAMPP, downloaded Magento, unzipped entire folder to htdocs.

Getting an error:

Fatal error: Uncaught Magento\Framework\Exception\FileSystemException: The "/opt/lampp/htdocs/magento2/var/.regenerate" file can't be deleted. Warning!unlink(/opt/lampp/htdocs/magento2/var/.regenerate): Permission denied in /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Driver/File.php:384 Stack trace: #0 /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Directory/Write.php(188): Magento\Framework\Filesystem\Driver\File->deleteFile('/opt/lampp/htdo...') #1 /opt/lampp/htdocs/magento2/vendor/magento/framework/Code/GeneratedFiles.php(99): Magento\Framework\Filesystem\Directory\Write->delete('/var/.regenerat...') #2 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/ObjectManagerFactory.php(111): Magento\Framework\Code\GeneratedFiles->cleanGeneratedFiles() #3 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/Bootstrap.php(210): Magento\Framework\App\ObjectManagerFactory->create(Array) #4 /opt/lampp/htdocs/magento2/vendor/magento/framework/App/Bootstrap.php(125): Magento\Framework\App\Bo in /opt/lampp/htdocs/magento2/vendor/magento/framework/Filesystem/Driver/File.php on line 384

Any help would be welcome

  • make sure you have an admin access
    – fmsthird
    Commented Jun 10, 2019 at 9:41

2 Answers 2


Run the command and try to refresh the page

chmod -R 777 var
rm -rf ./var/*

This error indicates that your file permissions are not correct.

You should have 777 permission to the var/ generated/ pub/ folder

if on Linux try below command. hope it helped!!

sudo chmod -R 0777 var/* generated/* pub/*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.