我正在尝试在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
答案 0 :(得分:0)
-D server.port=$PORT
应该是-Dserver.port=$PORT