I have installed Magento 2.1.0 successfully and also created many modules.

Suddenly after every php bin/magento setup:upgrade command , its not generating static contents.

The problem is after every setup:upgrade needs to have static content deploy command otherwise no CSS and JS works. If anyone can suggest me for a solution and the reason would be appreciable.

deploy mode is : developer

  • in Magento documentation: Developer mode:Static view files are not cached; they are written to the Magento pub/static directory every time they’re called
    – w.k
    Oct 24, 2016 at 14:06
  • Thank w.k, Yes if mode is set to developer then it must auto generate static content but that is the issue here. even though mode is set to developer static content are not auto generating after every upgrade command.
    – SPK
    Oct 25, 2016 at 7:10

3 Answers 3


I agree with you here in terms of needing to do this each time.

I am called to run setup:static-content:deploy with each upgrade and I have two languages so I need to run with the locale flag next to it, ie:

php bin/magento setup:static-content:deploy en_US <other locals>

However, we do have the option of --keep-generated with setup:upgrade. See the help:

php bin/magento setup:upgrade --help
 setup:upgrade [--keep-generated] [--magento-init-params="..."]

 --keep-generated       Prevents generated files from being deleted. 
                        We discourage using this option except when deploying to production. 
                        Consult your system integrator or administrator for more information.
 --magento-init-params  Add to any command to customize Magento initialization parameters
                        For example: "MAGE_MODE=developer&MAGE_DIRS[base][path]=/var/www/example.com&MAGE_DIRS[cache][path]=/var/tmp/cache"
 --help (-h)            Display this help message
 --quiet (-q)           Do not output any message
 --verbose (-v|vv|vvv)  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)         Display this application version
 --ansi                 Force ANSI output
 --no-ansi              Disable ANSI output
 --no-interaction (-n)  Do not ask any interactive question

It will keep static content.


setup:upgrade wipes everything. It is like manually emptying the generated, pub, and cache folders. If you do not deploy again, there won't be any files to build from.


To regenerate the static content (html, css, js) the command is:

php bin/magento setup:static-content:deploy

This will generate the static assets under pub/static.

Otherwise you can combine 2 commands with &&:

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

This will concatenate the 2 commands in 1, in particular if the first one is successful the second will be executed.

  • Elio thanks but you have not understood my question. I know this command is used to generated static contents.But my problem is whenever I run "php bin/magento setup:upgrade" command, it is also needed to run command - "php bin/magento setup:static-content:deploy" to generate css and js which is time taking. If I run "php bin/magento setup:upgrade" it should not ask for "php bin/magento setup:static-content:deploy" , what action should be taken for it.
    – SPK
    Nov 5, 2016 at 8:06
  • hi @SPK see my updated answer if can solve your question. Nov 7, 2016 at 12:30

Your Answer

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

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