简体   繁体   English

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

[英]Node.js express + React.js pushed to Heroku not working

I'm not able to push my repo on Heroku. 我无法在Heroku上推送我的仓库。

I'm getting an error Cannot GET / 我遇到错误Cannot GET /

Here's my structure: 这是我的结构:

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

My package.json file: 我的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"
  }
}

Any help will be greatly appreciated. 任何帮助将不胜感激。

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

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

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

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