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

See also: