React 应用程序在本地运行,在 Heroku 上时崩溃错误代码 = H10 [英] React app runs locally, crashes when on Heroku error code=H10

查看:17
本文介绍了React 应用程序在本地运行,在 Heroku 上时崩溃错误代码 = H10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序在 windows 中的npm start"后运行良好,但是当我从 github 拉入 Heroku 时,我只是收到一个错误.

The app runs fine after an 'npm start' in windows, but when I pull from github into Heroku I just get an error.

package.json:

package.json:

{
  "name": "tic-tac-toe",
  "version": "0.1.0",

  "dependencies": {
    "react": "^15.5.4",
    "react-dom": "^15.5.4"
  },
  "engines": {
      "node": "6.10.3",
      "npm":"3.10.10"
  },
  "devDependencies": {
    "react-scripts": "1.0.7"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  }
}

和错误日志:

 app[web.1]: npm ERR!     npm bugs tic-tac-toe
 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
 app[web.1]: npm ERR!     npm owner ls tic-tac-toe
 app[web.1]: npm ERR! There is likely additional logging output above.
 app[web.1]: 
 app[web.1]: npm ERR! Please include the following file with any support request:
 app[web.1]: npm ERR!     /app/npm-debug.log
 heroku[web.1]: Process exited with status 1
 heroku[web.1]: State changed from starting to crashed
 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=react-tac-to.herokuapp.com request_id=c3cf2461-1989-4734-a7d5-157eb81c9643 fwd="24.29.73.46" dyno= connect= service= status=503 bytes= protocol=https
 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=react-tac-to.herokuapp.com request_id=05109629-cbb4-4927-9d13-8a3a37fedb93 fwd="24.29.73.46" dyno= connect= service= status=503 bytes= protocol=https

问题的本质让我认为这是基于配置的,而不是主要的 app.js 代码.主文件有点长,所以如果你想看它,我会在 Github 上链接到它:https://github.com/owenpercoco/React-Tac-Toe

The nature of the problem makes me think this is configuration based, and not in the main app.js code. the main file is slightly long, so I'll link to it on Github if you want to see it: https://github.com/owenpercoco/React-Tac-Toe

推荐答案

Heroku 默认不安装 devdependencies:.https://devcenter.heroku.com/articles/nodejs-support.将您的 react-scripts 模块设置为始终在 Heroku 上安装或关闭生产模式.

Heroku doesnt install devdependencies by default:. https://devcenter.heroku.com/articles/nodejs-support. Either set your react-scripts module to always install or turn off production mode on Heroku.

这篇关于React 应用程序在本地运行,在 Heroku 上时崩溃错误代码 = H10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆