繁体   English   中英

在 Heroku 上部署 Spring Boot + Reacts JS 应用程序时出错 - 应用程序崩溃

[英]Error deploying Spring Boot + Reacts JS app on Heroku - app crashed

我正在尝试在 Heroku 上设置我的Spring Boot + React JS应用程序。 但是,每当我尝试部署它时,构建都是成功的,但是当我检查日志时应用程序崩溃了。

我尝试将代理更改为 Heroku 应用程序 web 链接,但这似乎不起作用。

这是我的package.json

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "engines": {
    "node": "12.10.0",
    "npm": "6.10.3"
  },
  "dependencies": {
    "react": "^16.10.0",
    "react-dom": "^16.10.0",
    "react-scripts": "3.1.2",
    "yarn": "^1.17.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "move-build": "mkdir -p ../main/resources/static && mv build/* ../main/resources/static/",
    "clean-old-build": "rm -rf ../main/resources/static/* ",
    "clean-new-build": "rm -rf build"
  },
  "proxy": "http://yumdrop.herokuapp.com",
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

这是Procfile

web: java -D server.port=$PORT $JAVA_OPTS -jar target/yumdrop-0.0.1-SNAPSHOT.jar

application.properties 文件

spring.mvc.view.suffix = .html
server.port=${PORT:8080}

Heroku 日志:

2019-10-01T23:47:08.000000+00:00 app[api]: Build started by user
2019-10-01T23:48:35.397819+00:00 app[api]: Release v17 created by user
2019-10-01T23:48:35.675405+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-01T23:48:35.397819+00:00 app[api]: Deploy 2beea1a1 by user aksrajvanshi@gmail.com
2019-10-01T23:48:41.000000+00:00 app[api]: Build succeeded
2019-10-01T23:48:43.535207+00:00 heroku[web.1]: Starting process with command `java -D server.port=58532 $JAVA_OPTS -jar target/yumdrop-0.0.1-SNAPSHOT.jar`
2019-10-01T23:48:45.401349+00:00 heroku[web.1]: State changed from starting to crashed
2019-10-01T23:48:45.381345+00:00 heroku[web.1]: Process exited with status 1
2019-10-01T23:48:45.171743+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-10-01T23:48:45.179027+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-10-01T23:48:45.321390+00:00 app[web.1]: Error: Could not find or load main class server.port=58532
2019-10-01T23:57:46.000000+00:00 app[api]: Build started by user aksrajvanshi@gmail.com
2019-10-01T23:59:18.665881+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-01T23:59:18.387311+00:00 app[api]: Release v18 created by user
2019-10-01T23:59:18.387311+00:00 app[api]: Deploy 88f083f1 by user 

-D server.port=$PORT应该是-Dserver.port=$PORT

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM