JS error

Solved

JS error

MohammadAL
Shopify Partner
21 0 1

why do i get this when i start the server?
• 04:46:06 ERROR » update assets/script.js:
Cannot overwrite generated asset 'assets/script.js'.

and this file isnt working / rendering, tho when i upload it directly to my shopify store, it works

Accepted Solution (1)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi MohammadAL,

 

A few questions to help me troubleshoot this for you:

 

  • Are you making changes to this file? 
  • If you delete this file manually on the admin and pull the theme, then add the JS file to the theme locally, is this working?
  • Is this a custom theme you're working on or a theme someone else has developed?
  • If you try the same flow with Dawn by running `shopify theme init` are you experiencing the same error - if so it might be related to how the CLI is configured. 
  • What version of the CLI are you using?

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

View solution in original post

Replies 4 (4)

Liam
Community Manager
3108 340 871

This is an accepted solution.

Hi MohammadAL,

 

A few questions to help me troubleshoot this for you:

 

  • Are you making changes to this file? 
  • If you delete this file manually on the admin and pull the theme, then add the JS file to the theme locally, is this working?
  • Is this a custom theme you're working on or a theme someone else has developed?
  • If you try the same flow with Dawn by running `shopify theme init` are you experiencing the same error - if so it might be related to how the CLI is configured. 
  • What version of the CLI are you using?

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

MohammadAL
Shopify Partner
21 0 1

1-  Yes
2-  Yes, if I do that the JS file works
3-  Yes, custom Theme
4-  No, works perfectly
5-  3.50.2

Liam
Community Manager
3108 340 871

Okay so it sounds like this is theme related rather than CLI related - it's possible that there's a change being made to the JS file that is not being accepted when you try to generate the theme. If you just make a simple change like a console.log is the error still appearing?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

MohammadAL
Shopify Partner
21 0 1

actually it got fixed, i did what u said, deleted it from admin, downloaded the theme then added the js file locally, and it worked, Thanks for your help ❤️