简体   繁体   中英

How to run Brunch + React on local network

I want share my generated Brunch project on my local network so that I can see how it runs on my mobile devices.

I am trying to do this by running http-server ( https://www.npmjs.com/package/http-server ) in the public catalogue.

When I navigate to http://127.0.0.1:8080 I see nothing on the page but I do see the generated app.js file but it doesn't run.

How do I share the Brunch project on the local network?

Firstly, make sure both your computer and mobile is on the same network.
Then, you need to find the IP address of your machine by typing ipconfig in the terminal.
So for instance if your IP is 192.168.1.100 , then you may open the react app (given it is up and running on port 8080) in your phone by going to 192.168.1.100:8080 and not http://127.0.0.1:8080 which is merely a loopback address

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