npm run build problem
See original GitHub issueI have got my project done,but when I npm run build
,I got the build folder,but when I open the index.html in build folder by chrome ,I just got a blank page,but actually I want to get it can be visual .
the index.html codes in build folder like this:
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="shortcut icon" href="/static/media/favicon.fd73a6eb.ico"><title>React App</title><link href="/static/css/main.9a0fe4f1.css" rel="stylesheet"></head><body><div id="root"></div><script type="text/javascript" src="/static/js/main.f39a5fd1.js"></script></body></html>
what can I do to build the project? p.s I have read the USER GUIDE ,but not get a perfect answer.
Issue Analytics
- State:
- Created 7 years ago
- Comments:21 (7 by maintainers)
When you run
npm run build
it displays instructions on how to run the server:You need to run a static server for these files, just like you would need to do it in production. Opening just HTML file from
file://
URL won’t work because the static paths are absolute rather than relative. And they are absolute because we want client-side routing to work (which does not work with relative asset URLs).I hope this helps!
@BrianNW
is not the correct setting. You need to use the deployment URL as the
homepage
setting:Additionally, you need to run
npm run build
after changing that setting. Please follow this guide exactly, and it will work.If not, please file a new issue.