0

in my case i have added a less file to compile a css file in my Base Module , but after I run this command "bin/magento setup:static-content:deploy -f" an error was occured like belllwo

  [Magento\Framework\Exception\FileSystemException]                                                                                                               
  Cannot read contents from file "/var/www/html/myproject/pub/static/frontend/Magento/blank/en_US/Mymodule_Base/style.css" Warning!file_get_contents(  
  /var/www/html/myproject/pub/static/frontend/Magento/blank/en_US/Mymodule_Base/style.css): failed to open stream: No such file or directory  

Ps : i have already grant all privileges with chmod 777 ans also with chown

can anyone help me please to run the command correctly

2

In most cases this happens due to empty less/css files.

Check if the file style.css or style.less located in the frontend directory of Mymodule_Base module is not empty. Add some css there. Then run

rm -rf var/view_preprocessed rm -rf pub/static/frontend

and then run static content deployment again.

2

these 2 lines may help:

find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +

assuming www-data is your server group

chown -R :www-data .

references: https://devdocs.magento.com/guides/v2.4/install-gde/prereq/file-system-perms.html#perms-set-two-users

2

Following command will help you for sure.

chmod -R 777 var pub generated 
php bin/magento setup:upgrade && php bin/magento setup:static-content:deploy en_US -f

If this helps you then hit like and accept as answer.

Thank you,
Hiren Patel

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.