html - Pictures not showing up on Heroku?

后端 未结 9 1698
说谎
说谎 2021-01-15 09:09

I deployed my static HTML website to Heroku using this tutorial (http://www.lemiffe.com/how-to-deploy-a-static-page-to-heroku-the-easy-way/) and my pictures won\'t show up ?

9条回答
  •  一整个雨季
    2021-01-15 09:24

    I had the same problem and found the problem to be the capitalized file type ('.PNG'). I believe Heroku is searching for files without any .toLowerCase() function applied. Which means you must request an exact match between your markup and your file with capitalization being important.

    This wasn't a problem on my local node / express server but became an issue after deploying to Heroku. Some of my images were showing up but others were getting 404 errors (i.e. the ones with capitalized file types). The smart thing to do is to always make your file types are lower case.

    I changed this:

    PUSA-Icon
    

    To this:

    PUSA-Icon
    

    I hope this helps anybody that came across this issue as it confused me for at least an hour. Good luck!

提交回复
热议问题