create-react-app npm run build command

2019-02-08 08:31发布

I have a built a small React application with create-react-app, and it runs fine from the local server after running npm start. OK so far.

However, when I run npm run build, the process appears to execute correctly (creates build folder, which contains the bundled js file and the index.html file), but when I open index.html in my browser it renders nothing. What am I missing?


Aside: I also tried uploading it to a remote server and when I went to the URL the browser came back with...

Forbidden: You don't have permission to access / on this server.

...if anyone has any idea how to resolve this I'd also appreciate it.

7条回答
狗以群分
2楼-- · 2019-02-08 09:00

After building your application through create-react-app create-react-app

Run command npm run build After that run command npm install -g serve & finally serve -s build

More detailed information can be found from here create-react-app-deployment

查看更多
登录 后发表回答