Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

JS error

MohammadAL
Shopify Partner
13 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
Shopify Staff
2669 288 730

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
Shopify Staff
2669 288 730

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
13 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
Shopify Staff
2669 288 730

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
13 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 ❤️