简体   繁体   English

图片在本地加载,但不在Heroku服务器上

[英]Image loading locally but not on heroku server

My code works fine on local deployment, but when uploaded to a heroku server, I get the error message "Failed to load resource: the server responded with a status of 404 (Not Found)" in relation to howling.jpg. 我的代码在本地部署上工作正常,但是当将其上载到heroku服务器时,收到与howling.jpg有关的错误消息“无法加载资源:服务器响应状态为404(未找到)”。 Checking the directory with bash shows that the image is on my heroku server to be used but I can't figure out why it won't load it. 用bash检查目录显示该图像在要使用的heroku服务器上,但我不知道为什么它无法加载。 My canvas in the html file loads without an issue. 我的html文件中的画布加载没有问题。

html code of image 图片的html代码

heroku bash displaying howling.jpg heroku bash显示howling.jpg

Did you reference howling.jpg with a relative reference in your code? 您是否在代码中引用了howling.jpg和相对引用?

If you used an absolute path the directory names may be different and you might not be able to locate your image. 如果使用绝对路径,则目录名称可能会不同,并且可能无法找到映像。

What is your code that is accessing/calling the image location? 您访问/调用图像位置的代码是什么? can you post it here please 你可以在这里张贴吗

通过放入图像文件夹并使用app.use 固定代码进行固定

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM