找不到文件 - http://localhost/path-file-script-or-image [英] File not found - http://localhost/path-file-script-or-image
问题描述
当我访问在 10.0.my.ip.address 处运行在我的 raspberry pi 上的节点应用程序时,该应用程序加载但未找到 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 并使用 express 静态文件从我的公共文件夹中呈现文件
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屋!