Search code examples
javascriptmoduleruntime-errorhttp-status-code-404

Failed to load resource: the server responded with 404


I can't solve my script problem. I have tried deploying my application on render.com however i keep getting this error for all of my javascript files. the application runs perfectly when I use VS Codes live server but once deployed this error appears. I would really appreciate if someone was able to help me resolve this issue. I have also linked images.

JS:

<script type="module" src="/public/JS/setupCart.js"></script>
<script type="module" src="/public/JS/app.js"></script>

Error:

setupCart.js:1 : Failed to load resource: the server responded with a status of404 ()

app.js:1 : Failed to load resource: the server responded with a status of404 ()

Live link to application here: https://guided-fashion.onrender.com
Github repo: https://github.com/ddelimond/Guided-Fashion

enter image description here enter image description here


Solution

  • In similar, kind of scenario I would suggest you to do

    1. Viewpage source (ctrl+U) while on your local where it is working fine.
    2. Ctrl + click the app.js and setupcart.js link on your website and look at t their address on the address bar of your browser.
    3. Do the similar thing on your hosted application and compare the both addresses and see if the folder exists on the both cases.