找不到文件-http://localhost/path-file-script-or-image [英] File not found - http://localhost/path-file-script-or-image
问题描述
当我访问在10.0.my.ip.address的树莓派上运行的节点应用程序时,该应用程序已加载,但未找到404多个文件.我的文件,脚本和图像的src看起来与此类似
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>
奇怪的是,这些代码行昨天起作用了.我添加了一些错误的src链接.我在桌面顶部重新启动了Apache服务器,然后突然间,我的桌面开始出现错误,所有src链接均为localhost/some-address.
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?
推荐答案
好吧,仅通过从src删除localhost并使用快速静态文件来渲染公用文件夹中的文件,即可解决此问题
Ok I resolved this issue simply by removing localhost from src and using express static files to render files from my public folder
这篇关于找不到文件-http://localhost/path-file-script-or-image的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!