exception ‘RuntimeException’ with message ‘Can’t create directory generated/code/Magento/Framework/App/ResourceConnection/.’ in lib\internal\Magento\Framework\Code\Generator.php:115
1
} elseif (
/**
* If makeResultFileDirectory only fails because the file is already created,
* a competing process has generated the file, no exception should be thrown.
*/
!$this->_ioObject->makeResultFileDirectory($resultClassName)
&& !$this->_ioObject->fileExists($resultDir)
) {
$this->_addError('Can\'t create directory ' . $resultDir . '.');
return false;
}
2
3
/**
* @param string $className
* @return string
*/
public function getResultFileDirectory($className)
{
$fileName = $this->generateResultFileName($className);
$pathParts = explode('/', $fileName);
unset($pathParts[count($pathParts) - 1]);
return implode('/', $pathParts) . '/';
}
4
5
/**
* Create directory
*
* @param string $path
* @param int $permissions
* @return bool
* @throws FileSystemException
*/
public function createDirectory($path, $permissions = 0777)
{
return $this->mkdirRecursive($path, $permissions);
}
So the issue is caused by insufficient filesystem permissions .
How to fix
Grant the PHP interpreter the writable permissions to the generated
folder :
chmod -R -v 777 generated
isn’t it dangerous to give 777 to generated ?
Why should it be dangerous?
dmitrii_fediuk
(Dmitrii Fediuk)
Split this topic
April 9, 2019, 5:40am
6