I recently deleted the files in pub/static. This was a mistake as it deleted .htaccess but Iuckly I found the file in magento2 github. With .htaccess, it fixed my store view but my adminhtml is now not functioning... I have flushed the cache, re-indexed. I've run "magento setup:static-content:deploy", but fails to fully complete, where it runs out of memory from the first deployment.
Does anyone have any suggestion in how to approach this? I'm running Magento 2.0.7 Community-edition.
Also is there a way to change theme through CLI?
I have faced the same problem, resolve by the following command:
Execcute the commans as in given sequence
1: rm -rf var/di/* var/generation/* var/cache/* var/page_cache/* var/view_preprocessed/* var/composer_home/cache/*
2: sudo chmod 777 var -R
3: sudo chmod 777 pub -R
4: sudo php bin/magento setup:static-content:deploy
5: Repeat step 2 & 3.
Hope this will also help you.
Thanks you for the reply ipragmatech.
Lucky I had another website with magento. I copied the pub/static/adminhtml folder into the other one. While doing so, it overwrite some files which only had 0kb... I think there lied the problem.
The site crashed again. I preformed the commands you have provided but the last command, "setup:static-content:deploy" doesnt complete and runs out of memory. I've checked the memory limit on php.ini and it is set at 512M which looks like more then enough.
I'm currently in developer mode and Magento document states that setup:static-content:deploy must be run in mode production. When I switch to production, it automatically executes the same code. I then run into a different error:
command returned non-zero exit code:
'php -f /home/yooshc5/public_html/americanretailsupply.net/bin/magento setup:static-content:deploy en_US 2>&1'
Same issue: https://github.com/magento/magento2/issues/2972
Solution: increase memory size to 512M...
same issue: https://github.com/magento/magento2/issues/2561