如何部署反应js单页面应用程序(SPA)

时间:2017-04-26 18:17:04

标签: javascript reactjs deployment react-router react-redux

我使用react路由器制作单页应用程序,我尝试用npm run build构建它,然后我将build文件夹上传到我的web服务器,但我的网站只显示背景。我想知道如何使它发挥作用。


2017-04-26T19:06:27.864737 + 00:00 app [web.1]:npm ERR!或者如果不是这样的话
可用,您可以通过以下方式获取信息:
2017-04-26T19:06:27.864910 + 00:00 app [web.1]:npm ERR! npm所有者ls notes-
app-client
2017-04-26T19:06:27.865077 + 00:00 app [web.1]:npm ERR!上面可能还有其他日志记录输出。
2017-04-26T19:06:27.870949 + 00:00 app [web.1]:
2017-04-26T19:06:27.871279 + 00:00 app [web.1]:npm ERR!请包括
以下任何支持请求的文件:
2017-04-26T19:06:27.871450 + 00:00 app [web.1]:npm ERR! /app/npm-debug.log
2017-04-26T19:06:27.993054 + 00:00 heroku [web.1]:状态从开始变为
坠毁2017-04-26T19:06:42.961236 + 00:00 heroku [router]:at = error code = H10
desc =“App 坠毁“method = GET path =”/“host = educationapp.herokuapp.com
request_id = 72015192-8122-4fba-beb0-69c8f1e38129 fwd =“49.228.99.168”dyno =
connect = service = status = 503 bytes = protocol = https
2017-04-26T19:06:43.534651 + 00:00 heroku [router]:at = error code = H10 desc =“App 坠毁“method = GET path =”/ favicon.ico“host = educationapp.herokuapp.com
request_id = 83684431-92be-4080-a2f8-7165e21f6c72 fwd =“49.228.99.168”dyno =
connect = service = status = 503 bytes = protocol = https
2017-04-26T19:14:57.478915 + 00:00 heroku [router]:at = error code = H10 desc =“App 坠毁“method = GET path =”/“host = educationapp.herokuapp.com
request_id = 022a219d-2299-4d23-b713-6bb75497f0e6 fwd =“49.228.99.168”dyno =
connect = service = status = 503 bytes = protocol = https
2017-04-26T19:14:57.922975 + 00:00 heroku [router]:at = error code = H10 desc =“App 坠毁“method = GET path =”/ favicon.ico“host = educationapp.herokuapp.com
request_id = ae9bf961-22a9-47f8-be5d-234d97f83ca3 fwd =“49.228.99.168”dyno =
connect = service = status = 503 bytes = protocol = https

1 个答案:

答案 0 :(得分:1)

Heroku没有针对React应用程序的官方部署buildpack。因此,您必须Mars Hall使用create-react-app-buildpack

这是获得此功能的link

请遵循此文档。如果您使用create-react-app开始开发,它将对您有所帮助。