running static-content:deploy on multi store-view, fails with following error variable @media-common is undefined on theme where the language en_US

  • have you working on developermode or production mode? May 2, 2016 at 13:11
  • locally on development
    – deroccha
    May 2, 2016 at 13:12
  • have you set client side development inside store configuration? May 2, 2016 at 13:15
  • Go to that file and on that line number change @media-common to @_media-common
    – Asish Hira
    May 2, 2016 at 13:15
  • @Asish Hira 5 hm interesting @_media-common seems to work can u explain why?
    – deroccha
    May 2, 2016 at 13:20

3 Answers 3


@deroccha, I have laid out an answer to this question over here https://magento.stackexchange.com/a/152944/1956.

The long and short of it, is that @media-common isn't within the scope of your theme, in one or more .less files. We're supposed to be able to control this via use of _extend.less (which would load our custom files after var/view_preprocessed/css/frontend/<Vendor>/<theme>/<locale>/css/source/lib/_responsive.less, but for some reason that doesn't always seem to work. That being the case, you can follow the instructions in the above link as a temporary solution.

UPDATE The use of _extend.less does work as long as there isn't another configuration somewhere, like adding an implicit css call on a page configuration xml file. An example implicit css call:

<head> <css src="css/custom/theme.css" /> </head> If there is this type of entry, then there shouldn't also be an @import in the theme's _extend.less ...either or should be used.


In my case the issue was caused by first letter in my custom styles file name. File name should start from underscore, it provides proper files merging queue. For instance,file with name product.less


caused error during static content deploy @media-common is undefined. Adding the underscore at the beginning of name resolved issue.

  • Thank you! I have the same problem all day and I thought I'd lose my mind because everything was correct. Adding an undercore to my custom less file names solved the issue! May 28, 2020 at 12:24

We found that deploying Magento 2 causes so much problems we just run in developer mode on the production site. Not a pretty solution but at least we can actually put sites live without a hundred errors.

Until the errors and the process is resolved by the core team we'll be using this solution. The github issue is more than a year old now. There is not even an official guide for deployment:


  • Running in developer mode vs production mode doesn't solve the issue of the @media-common variable not being within the scope of Less files being transpiled. I do feel your pain though.
    – ryanF
    Jan 5, 2017 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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