heroku:部署react rails单独的文件夹

时间:2019-03-12 03:03:41

标签: ruby-on-rails node.js ruby reactjs heroku

我正在尝试将我的应用程序部署到heroku,但是我找不到办法。我在根目录中有两个文件夹,“后”和“前”,第一个是Rails api应用,第二个是react应用。

我认为反应部署是可以的,但是红宝石不是。 我有所需的构建包: heroku / nodejs heroku /块状

请帮帮我! :)

/package.json

{
  "name": "sophia",
  "license": "MIT",
  "engines": {
    "node": "6.3.1"
  },
  "scripts": {
    "build": "cd front && npm install && npm run build && cd ..",
    "deploy": "cp -a front/build/. back/public/",
    "postinstall": "npm run build && npm run deploy && echo 'Client built!'"
  }
}

Procfile

web: cd front && PORT=3000 npm start
api: cd back PORT=3001 && bundle exec rails s

/front/package.json

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "proxy": "http://localhost:3001",
  "dependencies": {
    "react": "^16.8.4",
    "react-dom": "^16.8.4",
    "react-scripts": "2.1.8"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

Heroku错误

remote:          "homepage" :
remote:        
remote:        The build folder is ready to be deployed.
remote:        You may serve it with a static server:
remote:        
remote:          yarn global add serve
remote:          serve -s build
remote:        
remote:        Find out more about deployment here:
remote:        
remote:          
remote:        
remote:        
remote: -----> Caching build
remote:        - node_modules
remote:        
remote: -----> Pruning devDependencies
remote:        
remote: -----> Build succeeded!
remote:  !     Unmet dependencies don't fail npm install but may cause runtime issues
remote:        github.com/npm/npm/issues/7494
remote: 
remote: 
remote: -----> Change to Node.js build process 
remote:        Heroku has begun executing the "build" script defined in package.json
remote:        during Node.js builds.
remote: 
remote:        Read more: https://devcenter.heroku.com/changelog-items/1573
remote: 
remote: -----> App not compatible with buildpack: buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz
remote:        More info: devcenter.heroku.com/articles/buildpacks#detection-failure
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to sophia-social-network.
remote: 
To git.heroku.com/sophia-social-network.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'hgit.heroku.com/sophia-social-network.git'

0 个答案:

没有答案