【问题标题】:There are erros when deployed to Heroku部署到 Heroku 时出现错误
【发布时间】:2017-09-24 04:38:21
【问题描述】:

我的 rails 应用程序使用 react-rails,我将项目部署到 Heroku。并且顺利完成。但我无法连接 Heroku 上的项目。它显示错误页面。所以我检查了heroku日志。

2017-09-23T15:11:19.654651+00:00 app[web.1]: Started GET "/" for 31.200.230.123 at 2017-09-23 15:11:19 +0000
2017-09-23T15:11:19.710323+00:00 app[web.1]: Processing by DashboardsController#show as HTML
2017-09-23T15:11:20.013683+00:00 heroku[router]: at=info method=GET path="/" host=rockcms.herokuapp.com request_id=5c8bebb0-fc0b-4af3-8721-006a1f9829d1 fwd="31.200.230.123" dyno=web.1 connect=1ms service=366ms status=500 bytes=1733 protocol=https
2017-09-23T15:11:20.002369+00:00 app[web.1]: Completed 500 Internal Server Error in 292ms  
2017-09-23T15:11:20.008529+00:00 app[web.1]: ExecJS::ProgramError (ReferenceError: React is not defined):
2017-09-23T15:11:20.011167+00:00 app[web.1]: (execjs):35:12442
2017-09-23T15:11:20.011168+00:00 app[web.1]: (execjs):43:14

我认为,错误是由于反应而发生的。我需要正确的建议。 如果你需要一些信息,我会告诉他们。

谢谢!

【问题讨论】:

  • 它在本地环境中工作吗???
  • 是的,它工作正常

标签: javascript ruby-on-rails heroku react-rails


【解决方案1】:

将这些导入到您的反应代码所在的文件上方

import React from "react"; 
import ReactDOM from "react-dom";

【讨论】:

  • 我已将代码添加到所有使用 react 的文件中。但同样的错误:(
【解决方案2】:

需要如上所述的导入,或者您需要在生产服务器上执行 npm install

【讨论】:

猜你喜欢
  • 2017-12-18
  • 2014-11-09
  • 1970-01-01
  • 2019-06-12
  • 2020-09-22
  • 2021-10-29
  • 1970-01-01
  • 1970-01-01
  • 2020-09-28
相关资源
最近更新 更多