create-react-app npm run build command

前端 未结 9 787
春和景丽
春和景丽 2020-12-15 18:03

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.

9条回答
  •  渐次进展
    2020-12-15 18:07

    https://www.taniarascia.com/getting-started-with-react/ and The final script can be found on the GitHub.

    npm run build -> will create a folder build which include the index.html and static folder. By just clicking the index.html will open on a new browser's tab. But it shows only blank page. Why? because it's need a server to make it works.

    Solution :

    Move the file on other folder. Open the folder using VC Code. Open the index.html and right click -> select : Open with live server. A new tabs opened on your browser with related ip address and port.

    Or you can run it on localhost using xampp :

    Open the XAMPP server. Place it on localhost. And it must work.

提交回复
热议问题