Magento 2.2.8 – Fix setup:static-content:deploy Errors

errormagento2.2static-contentstatic-content-deploy

I can't deploy static content on my production site. Running command:

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

Gives me following error:

[Magento\Framework\Exception\FileSystemException] Cannot read
contents from file
"magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css"
Warning!file_get_contents(magento2/http/pub/static/adminhtml/Magento/backend/en_US/Magento_ConfigurableProduct/product/product.css):
failed to open stream: No such file or directory

For some reason, when not specifying the locale, it went through fine.

What could be causing the problem?

UPDATE:

The file permission of the aforementioned file looks a bit weird?

lrwxrwxrwx 1 xxx xxx  113 May  8 15:08 product.css -> magento2/http/vendor/magento/module-configurable-product/view/adminhtml/web/product/product.css

UPDATE 2:

Found out that this is a symlink that points to a file somewhere else on my server. These are the file permissions of the file where the symlink is pointing to:

-rw-r--r-- 1 xxx xxx 3863 May  7 06:35 product.css

Should I change these file permissions? If so, what would I changed them to to keep me site secure?

Best Answer

That caused by permission.

  1. You can upgrade and deploy again.

php bin/magento setup:upgrade php bin/magento setup:static-content:deploy en_GB

  1. if it still error, pls run command on root:

find app/code lib var generated vendor pub/static pub/media app/etc ( -type d -or -type f ) -exec chmod g+w {} + && chmod o+rwx app/etc/env.php

After that, repeat step 1.

Related Topic