如何解决node js express 错误找不到视图目录
所以我有我运行的这个 node js express 项目(从 github 获得,不是我制作的,但我当然理解它)当我在我的本地主机上运行它时它完全按预期运行但是当在我的网站上运行时它给出了以下内容错误
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 举报,一经查实,本站将立刻删除。