node js express 错误找不到视图目录

问题描述

所以我有我运行的这个 node js express 项目(从 gi​​thub 获得,不是我制作的,但我当然理解它)当我在我的本地主机上运行它时它完全按预期运行但是当在我的网站上运行时它给出了以下内容错误

Error: Failed to lookup view "/home/dh_vemh38/thepog.xyz/public/dashboard/templates/index.ejs" in views directory "/home/dh_vemh38/thepog.xyz/public/views"
    at Function.render (/home/dh_vemh38/node_modules/express/lib/application.js:580:17)
    at ServerResponse.render (/home/dh_vemh38/node_modules/express/lib/response.js:1012:7)
    at renderTemplate (/home/dh_vemh38/thepog.xyz/dashboard/dashboard.js:114:9)
    at /home/dh_vemh38/thepog.xyz/dashboard/dashboard.js:170:5
    at Layer.handle [as handle_request] (/home/dh_vemh38/node_modules/express/lib/router/layer.js:95:5)
    at next (/home/dh_vemh38/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/home/dh_vemh38/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/home/dh_vemh38/node_modules/express/lib/router/layer.js:95:5)
    at /home/dh_vemh38/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/home/dh_vemh38/node_modules/express/lib/router/index.js:335:12)
    at next (/home/dh_vemh38/node_modules/express/lib/router/index.js:275:10)
    at SendStream.error (/home/dh_vemh38/node_modules/serve-static/index.js:121:7)
    at SendStream.emit (node:events:394:28)
    at SendStream.error (/home/dh_vemh38/node_modules/send/index.js:270:17)
    at SendStream.onStatError (/home/dh_vemh38/node_modules/send/index.js:421:12)
    at next (/home/dh_vemh38/node_modules/send/index.js:763:28)

它说它无法查找视图目录,是重命名删除了还是什么?不,因为甚至没有视图目录。这让我感到困惑,为什么它在从未调用过的情况下搜索视图目录?

额外信息: 在 Dreamhost https://www.dreamhost.com/ 上托管 启用节点 js 乘客 已安装 node v16.5.0 和 npm v7.19.1 安装了所有模块 放入正确的配置 github 存储库 https://github.com/MrAugu/simple-discordjs-dashboard/

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)