找不到文件 - http://localhost/path-file-script-or-image [英] File not found - http://localhost/path-file-script-or-image

查看:31
本文介绍了找不到文件 - 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆