0

Problem:

I am installing Magento 2 on live server. While the site displays product info and some of the product images, there are no styles and JavaScript functions don't work.

Solution attempts/debugging:

I have seen a number of articles on inaccessible css/js files and have tried what they suggested to no avail. I follow instructions from here: https://mage2.pro/t/topic/259. But still no luck.

i've tried suggestion from Sandeep Pandey in https://mage2.pro/t/topic/259, it manage to solve the problem at first, but then when i change logo of my website or add new product, the problem occur again, the css and js wont load.

Questions

Does anyone have any ideas for solving this problem? Should i run command chmod 777 var -R & chmod 777 pub -R everytime i made changes on my website? Any suggestion?

0

You can run the following command

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

There are 2 methods to solve it:

  • Using command:

    1. Open terminal and cd to magento installation directory.

    2. Run below command:

    php bin/magento setup:static-content:deploy

  • Manual:

    1. Go to pub/static folder and remove everything, except .htaccess file.

    2. Open up app/etc/di.xml find the path Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy.

    3. Remove cache and reload frontend.

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

remove var/view_preprocessed folder

-1

Update to the latest version solve this problem.

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • This does not provide any explanation, but it's true, because in Magento 2.0.6 they made the file permissions less restrictive by default to address exactly this problem. – Fabian Schmengler Jun 2 '16 at 6:44

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.