2

My Magento 2.08 was working fine, but due to new features introduced in Magento 2.1 and curiosity of knowing how upgrade works in Magento 2, I tried to upgrade my Magento to latest stable version of Magento, i.e. Magento 2.1.

Everything went fine and I found admin panel functionality was working fine after upgrade.

But frontend is not working anymore now.

I inspected the problem and found that styles-m.css and styles-l.css are showing 404 not found error in page source.

Also below is my system.log file content:

[2016-08-10 04:09:15] main.CRITICAL: 
Compilation from source: 
frontend/Srm/cookbook/en_US/css/styles-l.less
Unable to get content for 'frontend/Srm/cookbook/en_US/Magento_Theme/css/source/module/_collapsible_navigation.less' [] []
[2016-08-10 04:09:15] main.CRITICAL: 
Compilation from source: 
frontend/Srm/cookbook/en_US/css/styles-m.less
Unable to get content for 'frontend/Srm/cookbook/en_US/Magento_Theme/css/source/module/_collapsible_navigation.less' [] []

I also tried to run grunt exec:<themename>, but I got below message:

A valid Gruntfile could not be found. Please see the getting started guide for
more information on how to configure grunt: http://gruntjs.com/getting-started
Fatal error: Unable to find Gruntfile.

Please help me to resolve this problem.

Thanks in advance

  • Have you check you compilation mode in admin ? – Suresh Chikani Aug 10 '16 at 5:27
  • I have tried to compile, but no luck. – Mohit Kumar Arora Aug 10 '16 at 5:48
  • Compilation mode must be client side when we deploying. kindly check it. – Suresh Chikani Aug 10 '16 at 6:22
  • How can I check and change compilation mode. Please help. I am new to magento 2. – Mohit Kumar Arora Aug 10 '16 at 6:50
2

I suggest you to turn on theme to developer mode if your are not on production mode.

Either by,

php bin/magento deploy:mode:set developer

Or, Goto app/etc/env.php

change 'MAGE_MODE' => 'default'' to MAGE_MODE' => 'developer',

After all, follow these steps:

  1. Run Command Prompt

  2. Navigate to magento 2 installation directory.

  3. Run

php bin/magento setup:static-content:deploy

  1. Navigate to var directory.

  2. Run

rm -rf var/cache/*

rm -rf var/composer_home/*

rm -rf var/generation/*

rm -rf var/page_cache/*

rm -rf var/view_preprocessed/*

  1. Run

php bin/magento indexer:reindex

Now, it must work fine !!

1

You can try to regenerate the static content by doing the below steps -

1. Delete all folders under pub/static
2. Delete var/cache
3. Delete var/composer_home
4. Delete var/generation
5. Delete var/page_cache
6. Delete var/view_preprocessed

Now open your command prompt and go to your root installation of magento 2 and run the following command

php bin/magento setup:static-content:deploy
  • php bin/magento setup:static-content:deploy is not working for magento 2.1. – Mohit Kumar Arora Aug 10 '16 at 5:57
  • I am getting this error: [InvalidArgumentException] There are no commands defined in the "setup:static-content" namespace. – Mohit Kumar Arora Aug 10 '16 at 5:58
  • Try to give 777 permission to both pub and var folders and check. – Swapna Taru Aug 10 '16 at 9:23
0

You can find out compilation mode from here :

Store >> Configuration >> Developer >> Frontend Development Workflow >> Workflow type >> 

Select "Client side less compilation"

Remove Var/ and pub/static/

Run Below command

php bin/magento setup:static-content:deploy

Check now still issue or not.

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.