Node.js Express + React.js推送到Heroku无法正常工作

时间:2018-11-06 20:50:10

标签: node.js reactjs heroku npm-scripts

我无法在Heroku上推送我的仓库。

我遇到错误Cannot GET /

这是我的结构:

server.js
package.json (server)
  /client
    build
    package.json (client)

我的package.json文件:

{
  "name": "debord_slow_sender",
  "version": "1.0.0",
  "proxy": "http://localhost:5000",
  "description": "",
  "scripts": {
    "start": "node server.js",
    "client": "cd client && npm start",
    "build": "react-scripts build",
    "server": "nodemon server.js",
    "dev": "concurrently --kill-others-on-fail \"npm server\" \"npm client\"",
    "heroku-postbuild": "cd client && npm install && npm run build"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "express": "^4.16.2",
    "images-scraper": "^2.0.11",
    "ml5": "^0.1.1",
    "node-tesseract": "^0.2.7",
    "pixabay-api": "^1.0.4",
    "request": "^2.88.0",
    "socket.io": "^2.1.1"
  },
  "devDependencies": {
    "concurrently": "^3.5.0"
  }
}

任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

尝试将您的heroku-postbuild更改为此:

"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false && npm install --prefix client && npm run build --prefix client"