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

And my error: 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 Sep 23, 2019 at 13:31
  • Please try this: bin/magento setup:static-content:deploy -f
    – Ravi Soni
    Sep 23, 2019 at 13:35
  • All this does not work Sep 23, 2019 at 13:46
  • Have you checked the version compatibility with your PHP and other modules?
    – MGento
    Sep 23, 2019 at 14:17
  • Yes, and also I updated all the modules that needed this Sep 23, 2019 at 14:27

3 Answers 3


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 Sep 23, 2019 at 14:29
  • What is error on var/log ? Sep 23, 2019 at 14:33
  • run command ls -l at root directory and check what is permissions for 'var, pub and generated' directory ? Sep 23, 2019 at 14:38
  • I checked that I have the correct permissions for these directories: 777 Sep 23, 2019 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 and acknowledge you have read our privacy policy.

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