简体   繁体   中英

How to deploy react js single page application (SPA)

I use react router make single page application, and I try to build it with npm run build then I upload build folder to my web-server but my website just shows background. I want to know how to make it work.


2017-04-26T19:06:27.864737+00:00 app[web.1]: npm ERR! Or if that isn't
available, you can get their info via:
2017-04-26T19:06:27.864910+00:00 app[web.1]: npm ERR! npm owner ls notes-
app-client
2017-04-26T19:06:27.865077+00:00 app[web.1]: npm ERR! There is likely
additional logging output above.
2017-04-26T19:06:27.870949+00:00 app[web.1]:
2017-04-26T19:06:27.871279+00:00 app[web.1]: npm ERR! Please include the
following file with any support request:
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]: State changed from starting to
crashed 2017-04-26T19:06:42.961236+00:00 heroku[router]: at=error code=H10
desc="App
crashed" 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
crashed" 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
crashed" 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
crashed" 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

Heroku don't have official deployment buildpack for React apps. So you have to use create-react-app-buildpack by Mars Hall .

Here is the link to get this.

Please follow this documentation. It will help you if you have started your development using create-react-app .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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