Questions and discussions about using the Shopify CLI and Shopify-built libraries.
Hi, I'm developing a Shopify theme on local using shopify theme serve.
When I tried to edit the file app.js.liquid, the theme CLI keep throwing the error Cannot overwrite generated asset 'assets/app.js'. And the change is not applied.
I found some questions with answers on the forum but seem like it does not relate to my case.
Any help would be appreciated!
Thanks in advance!
Solved! Go to the solution
This is an accepted solution.
Hello Duandz. Hope you resolved the issue. But if you have not we have encountered the same error recently with different asset type. Somehow when we run the shopify theme serve something occurs that duplicates the file on the server. So if you do Shopify theme pull and pull your development theme locally you should see in your asset folder both assets/app.js and assets/app.js.liquid. One was somehow generated by the Shopify itself.
Those files are probably the same but what you would want to do is to leave the .liquid one as I assume that you have some variables in it and search for app.js one without liquid extension and delete that one. Shut down the serve and rerun the Shopify theme serve. This connects to https://community.shopify.com/c/shopify-apis-and-sdks/put-asset-returns-quot-cannot-overwrite-genera... . If its something even bugged asset generated by Shopify it wont be syncable practically. There is a reason why this probably happens but I could not find it. Would find it probably if i reviewed their core code. Hope this helps you if you already did not fix it but I am also writing it for the sake of the next poor soul that will loose their time debugging issue similar to this one.
This is an accepted solution.
Hello Duandz. Hope you resolved the issue. But if you have not we have encountered the same error recently with different asset type. Somehow when we run the shopify theme serve something occurs that duplicates the file on the server. So if you do Shopify theme pull and pull your development theme locally you should see in your asset folder both assets/app.js and assets/app.js.liquid. One was somehow generated by the Shopify itself.
Those files are probably the same but what you would want to do is to leave the .liquid one as I assume that you have some variables in it and search for app.js one without liquid extension and delete that one. Shut down the serve and rerun the Shopify theme serve. This connects to https://community.shopify.com/c/shopify-apis-and-sdks/put-asset-returns-quot-cannot-overwrite-genera... . If its something even bugged asset generated by Shopify it wont be syncable practically. There is a reason why this probably happens but I could not find it. Would find it probably if i reviewed their core code. Hope this helps you if you already did not fix it but I am also writing it for the sake of the next poor soul that will loose their time debugging issue similar to this one.
Hi @GoranHorvat, thank you very much. Deleting the app.js file does help. Everything is working fine now. Cheer.