File not found - http://localhost/path-file-script-or-image

谁说胖子不能爱 提交于 2019-12-24 00:49:51

问题


When I visit my node application running on my raspberry pi at 10.0.my.ip.address the app loads but get 404 multiple files not found. The src to my files, scripts and images look similar to this

<link rel="stylesheet" href="http://localhost/Ziroid_Functions/Clovis_App/public/clovisapp.css">

<img src="http://localhost/Ziroid_Functions/Clovis_App/public/img/doubleUp.png" alt="Smiley face" >

<script type="text/javascript" src="http://localhost/Ziroid_Functions/Clovis_App/public/js/radar.js"></script>

Whats weird is that these lines on code worked yesterday. I added a few more src links which got errors. I restarted my apache server on desktop top then all the sudden my desktop started getting errors with all src links being localhost/some-address.

I tried loading application on my other computer and all the scirpts,images and links load fine.

What might the problem be and how do I fix this?


回答1:


Ok I resolved this issue simply by removing localhost from src and using express static files to render files from my public folder



来源:https://stackoverflow.com/questions/54299940/file-not-found-http-localhost-path-file-script-or-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!