-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploying a new theme fails #63
Comments
@avra911 Are you certain that running I don't know whether it is fixed in 2.1.5, but as of 2.1.2, if Magento was running in production mode, you had to manually insert the new theme into the |
Yes, @erikhansen, I connected to the server, checked static-content-deploy which failed, then run setup:upgrade which added the theme into database, then run again static-content-deploy and it did the trick. The only problem I noticed with record in theme table was the TYPE column was set to 1 instead of 0, but that is a different thing. |
@avra911 Interesting. The problem with moving I'm sure @davidalger will have an idea for the best way to handle this. |
Yes, I am aware of that too. Adding the theme manually in database seems a decent workaround, I posted here to find other ideas. Thank you, @erikhansen! |
I can confirm this issue, as running Perhaps you can add some flag that can be set on deploying new theme? |
Exactly why this wasn't accounted for when I built the gem initially :) Reversing the order of the commands is definitely not a good working solution, as it will heavily increase the downtime from seconds to minutes. What I think makes sense here actually is to simply wait till Magento 2.2 is released soon. I haven't had the chance to build a test repository with 2.2-dev yet to see how it interacts with this gem, but the static content deployment is no longer supposed to require a database connection. They are doing this so that Magento can be build on a CI server and then that image pushed to cloud servers via whatever mechanism on wishes to use, but that change should solve this in some way as well, as the static content deploy command will no longer be relying on what's in the database to determine what to deploy. I'll find out more when 2.2 is released and I can test with the GA release. If anyone wants to propose a working solution to solve this on 2.1, I'm all ears, but given how infrequently the issue occurs (since nobody I know deployed a new theme ever day) I can't really justify the time to try and build a workaround into this gem if implementing the workaround is either going to have negative side-effects across the majority of deployments or take a significant amount of effort to develop. |
I just ran into this on a deploy of 2.2.2 where the initial deployment was done with a clean install of 2.2.2 and then a new theme was added to the repo, and when it was deployed it failed during the static content deploy "php -f bin/magento -- setup:static-content:deploy -f en_US" The database did not have the new themes in the database theme table, but static content deploy was trying to build static assets for the new theme even though it wasn't yet in the database. When it tried to build the static assets for the new theme it seemed to be failing at different points when making calls to Magento\Framework\View\Asset\File->getSourceFile()
After only running setup:upgrade and setup:di:compile the setup:static-content:deploy worked fine and completed without errors. |
I've run into this issue multiple times over the past months (including on 2.2.2). My workaround has been to insert the new theme records from my local According to the details at the bottom of this issue it looks like the core Magento issue should be fixed in 2.3. |
I've also just run in to this issue in 2.2.2, I'll give the discussed work arounds a try. |
Still present in Magento 2.2.3, which I can reproduce as mentioned in #100 |
this is becoming a problem when we constantly testing/ developing themes on one of our projects... |
As this is not an issue in this tool but due to how Magento handles themes, I'm going to close this out. Unfortunately doing a full setup:upgrade before static content deployment would make deployments take significantly longer and eliminate zero-down deployments when the upgrade was actually unnecessary. Where frequent deployments of new themes are made, my suggestion would be to add a custom routine to your specific project to insert the theme record before static content deployment runs. Cheers! |
When deploying a new theme, it fails because
setup:static-content:deploy
runs beforesetup:upgrade
and there is no such theme found intheme
table in database.Error thrown is:
Wonder if static content should not be moved after setup upgrade.
The text was updated successfully, but these errors were encountered: