【问题标题】:How to fix another route Vue.js on Node.js如何在 Node.js 上修复另一个路由 Vue.js
【发布时间】:2021-08-19 06:48:29
【问题描述】:

我使用“npm run build”构建 vuejs 并获取 dist 文件夹。在 dist 文件夹中有 index.html 文件。 在 nodejs 服务器文件 index.js 上,我编写代码“app.use(express.static(path.join(__dirname, 'dist')))”以运行 index.html 以显示我的网站,但另一条路线不起作用。就像“/”正在工作但“/about”不起作用如何解决它。 非常感谢你

【问题讨论】:

  • 你在用vue-router吗?
  • 我建议通过 nginX 为您的 dist 文件夹提供服务。

标签: node.js vue.js


【解决方案1】:

你不能改变你的 dist 文件夹, 您的 vue js 代码有一些错误, 你应该修复它们,修复后再次构建你的网站

发送您的路线文件“/about”

这有一些错误

【讨论】:

  • 我不明白,你能解释一下
  • 您的代码有一些错误,您无法通过更改 dist(构建文件)来修复它们,您应该修复原始代码,然后构建您的代码并创建新的 dist(构建文件)
猜你喜欢
  • 2012-12-24
  • 2016-08-08
  • 2018-06-15
  • 2017-01-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-04-02
  • 1970-01-01
相关资源
最近更新 更多