When i run command bin/magento setup:static-content:deploy i give errors:

enter image description here

And my second error:

frontend/Magento/blank/en_US 4225/4225 ============================ 100% % 54 secs
adminhtml/Magento/backend/en_US 4832/4832 ============================ 100% % 1 min
frontend/Magento/luma/en_US 4241/4241 ============================ 100% % 56 secs
frontend/Alias/mytheme/en_US 4647/4647 ============================ 100% % 46 secs
adminhtml/Alias/mytheme/en_US 1355/4832 =======>-------------------- 28% % 45 secs

In File.php line 151: The contents from the "/var/www/project/pub/static/frontend/Alias/mytheme/en_US/css/source/lib/useful.css" file can't be read. Warning!file_get_contents(/var/www/project/pub/static/frontend/Alias/mytheme/en_US/css/source/lib/useful.css): failed to open stream: No such file or directory

How to fix it? Thanks)

  • try to do with this command - sudo php bin/magento setup:static-content:deploy – Anas Mansuri Sep 23 '19 at 13:31
  • Please try this: bin/magento setup:static-content:deploy -f – Ravi Soni Sep 23 '19 at 13:35
  • All this does not work – David Young Sep 23 '19 at 13:46
  • Have you checked the version compatibility with your PHP and other modules? – MGento Sep 23 '19 at 14:17
  • Yes, and also I updated all the modules that needed this – David Young Sep 23 '19 at 14:27

You need to change permissions or ownership of the project directory

To see who is currently logged user, run Linux command:


To change the owner use the chown command:

$sudo chown -R username:username /magento-project-root

now run command for permission

$sudo chmod -R 755  /magento-project-root

cd magento-project-root

sudo chmod -R 777 var/ pub/ generated/

php bin/magento setup:static-content:deploy -f

if still not working then check error at var/log directory

  • I did it and it didn’t help – David Young Sep 23 '19 at 14:29
  • What is error on var/log ? – Rajesh Hothi Sep 23 '19 at 14:33
  • run command ls -l at root directory and check what is permissions for 'var, pub and generated' directory ? – Rajesh Hothi Sep 23 '19 at 14:38
  • I checked that I have the correct permissions for these directories: 777 – David Young Sep 23 '19 at 14:55

Try below steps:-

sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo rm -rf generated/*

sudo chmod -R 777 /var/www/html/(project name)/
sudo php bin/magento setup:upgrade
sudo php bin/magento setup:static-content:deploy -f
sudo php bin/magento ca:cl
sudo php bin/magento ca:fl
sudo chmod -R 777 /var/www/html/(project name)/

Hope it's works for you


Try to delete the folder ~ "var/www/project/design/frontend/Alias/mytheme/web/css/source", and run the command php bin/magento setup:static-content:deploy -f If everything goes well the problem is in the styles

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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