How to fix the «Can't create directory 'generated/code' in Magento/Framework/Code/Generator.php» Magento 2.2 issue?

exception ‘RuntimeException’ with message ‘Can’t create directory generated/code/Magento/Framework/App/ResourceConnection/.’ in lib\internal\Magento\Framework\Code\Generator.php:115

1

2

3


4

5

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

See also:

isn’t it dangerous to give 777 to generated ?

Why should it be dangerous?

A post was split to a new topic: How to fix “Command line user does not have read and write permissions on generated directory. Please address this issue before using Magento command line”