JS error

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

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?

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

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?

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 :heart: