我最近在heroku上部署了Rails应用程序,但是没有任何问题,现在,我正在尝试在heroku上部署Rails / react应用程序,这让我很费时间。有人可以帮我指出正确的方向吗?我为heroku添加了nodejs和ruby buildpacks。恐怕我缺少将两个环境连接在一起的功能。这是我当前遇到的错误,请多多关照。谢谢!
```remote: -----> Build
remote: Detected both "build" and "heroku-postbuild" scripts
remote: Running heroku-postbuild
remote:
remote: > gone-fishin-frontend@0.1.0 heroku-postbuild /tmp/build_0df26b25
remote: > npm run build && npm install
remote:
remote:
remote: > gone-fishin-frontend@0.1.0 build /tmp/build_0df26b25
remote: > react-scripts build
remote:
remote: Creating an optimized production build...
remote: Compiled successfully.
remote:
remote: File sizes after gzip:
remote:
remote: 63.32 KB build/static/js/2.b0463501.chunk.js
remote: 2.48 KB build/static/js/main.61d8b38a.chunk.js
remote: 783 B build/static/js/runtime-main.44a3a2b0.js
remote: 690 B build/static/css/main.10cdadf4.chunk.css
remote:
remote: The project was built assuming it is hosted at /.
remote: You can control this with the homepage field in your package.json.
remote:
remote: The build folder is ready to be deployed.
remote: You may serve it with a static server:
remote:
remote: npm install -g serve
remote: serve -s build
remote:
remote: Find out more about deployment here:
remote:
remote: bit.ly/CRA-deploy
remote:
remote: removed 35 packages and audited 1737 packages in 14.177s
remote:
remote: 71 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Caching build
remote: - node_modules
remote:
remote: -----> Pruning devDependencies
remote: removed 35 packages and audited 1737 packages in 12.724s
remote:
remote: 71 packages are looking for funding
remote: run `npm fund` for details
remote:
remote: found 0 vulnerabilities
remote:
remote:
remote: -----> Build succeeded!
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to gonefishin-frontend.
remote:
To https://git.heroku.com/gonefishin-frontend.git```
这是我的package.json
```{
"name": "gone-fishin-frontend",
"version": "0.1.0",
"private": true,
"engines": {
"npm": "6.14.6",
"node": "14.5.0"
},
"proxy": "http://localhost:3001",
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-redux": "^7.2.1",
"react-router-dom": "^5.2.0",
"react-scripts": "^3.4.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0",
"styled-components": "^5.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"deploy": "cp -a client/build/. public/",
"heroku-postbuild": "npm run build && npm install",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
},
"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"
]
}
}
```
答案 0 :(得分:0)
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
请参阅Heroku文章链接。
您可以找到Ruby detect
script here。
您的项目与Ruby buildpack不兼容,因为它在git仓库的根目录中缺少Gemfile
。