【问题标题】:Heroku Error: ENOENT: no such file or directoryHeroku 错误:ENOENT:没有这样的文件或目录
【发布时间】:2021-03-30 02:26:31
【问题描述】:

下午好,我想在 heroku 上部署我的项目,但它不起作用。日志的错误是可以理解的,但为什么会发生在我身上尚不清楚。错误在于heroku在dist中找不到index.html,虽然dist是本地创建的,index也在其中。

我附上了repositoryscreenshot of logs of Herokuscreen of dist folder in project 的链接,希望对您有所帮助

【问题讨论】:

    标签: node.js reactjs heroku webpack deployment


    【解决方案1】:

    尝试在 Heroku 部署过程中添加 /client 文件夹中的命令 yarn build。或者,从您的 .gitignore 文件中删除 dist 文件夹,以便最终构建保留在存储库中。

    【讨论】:

    • 感谢您的提示,它有效,但我认为这不是正确的解决方案,是吗?
    • 正确的解决方案是将构建脚本添加到您的部署过程中
    • 请告诉我怎么做
    • 你能给我一些链接,我可以找到如何做到这一点
    • 只需将此 "build": "cd client && npm run build", 添加到您的 package.json 上的脚本中,因为 Heroku 现在会在部署时自动运行 build 脚本。链接在这里:devcenter.heroku.com/changelog-items/1557
    猜你喜欢
    • 2023-03-29
    • 2013-07-28
    • 2019-08-31
    • 1970-01-01
    • 2017-10-07
    • 2021-02-15
    • 2019-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多