【问题标题】:Deployed project successfully, Heroku 503 error when trying to open in web成功部署项目,尝试在 Web 中打开时出现 Heroku 503 错误
【发布时间】:2022-02-02 14:32:08
【问题描述】:

能够将我的堆栈应用程序推送到 Heroku 并成功部署,没有错误,但打开链接时出现 503 错误。我很好奇我的 package.json 中是否缺少某些内容,或者我的服务器设置不正确。 “heroku logs --tail”能够向我显示错误,下面的错误说我缺少脚本启动。我已经检查了 package.json 中的脚本,但我没有错过 package.json 中的启动脚本,并在我的服务器 package.json 中添加了构建脚本来构建我的 React 应用程序。我的完整项目在这里可用:

https://github.com/Pillbug23/caltrails.github.io

2022-02-02T06:07:23.227967+00:00 app[web.1]: npm ERR! Missing script: "start"
2022-02-02T06:07:23.228160+00:00 app[web.1]: npm ERR!
2022-02-02T06:07:23.228451+00:00 app[web.1]: npm ERR! Did you mean one of these?
2022-02-02T06:07:23.228682+00:00 app[web.1]: npm ERR!     npm star # Mark your favorite packages
2022-02-02T06:07:23.228922+00:00 app[web.1]: npm ERR!     npm stars # View packages marked as favorites
2022-02-02T06:07:23.229031+00:00 app[web.1]: npm ERR!
2022-02-02T06:07:23.229122+00:00 app[web.1]: npm ERR! To see a list of scripts, run:
2022-02-02T06:07:23.229220+00:00 app[web.1]: npm ERR!   npm run
2022-02-02T06:07:23.241797+00:00 app[web.1]:
2022-02-02T06:07:23.242242+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2022-02-02T06:07:23.242362+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2022-02-02T06_07_23_230Z-debug.log
2022-02-02T06:07:23.394883+00:00 heroku[web.1]: Process exited with status 1

【问题讨论】:

    标签: node.js npm heroku package.json


    【解决方案1】:

    您的 package.json 文件缺少节点 js 版本声明。 Heroku 在针对特定版本进行构建时需要它。

    "engines": {
        "node": "14.x"
      },
    

    查看此链接了解更多信息。 https://devcenter.heroku.com/articles/deploying-nodejs#specify-the-version-of-node

    【讨论】:

      猜你喜欢
      • 2019-11-27
      • 1970-01-01
      • 2018-11-07
      • 2020-10-29
      • 2020-10-21
      • 1970-01-01
      • 1970-01-01
      • 2018-07-14
      • 2018-07-12
      相关资源
      最近更新 更多