vue-cli3.0 start the project, other computers in the LAN through their ip access

Recently been using vue-cli3.0 do the project,

After package.json configure, since the launch of the project, and no attention had black windows,

"scripts": {
    "serve": "vue-cli-service serve --open",  // 自启动浏览器
    "build": "vue-cli-service build"
  },

After starting the discovery, as not only Local, as well as Network

 App running at:
  - Local:   http://localhost:8080
  - Network: http://110.119.114.66:8080   // 当然ip是随意的

  Note that the development build is not optimized.
  To create a production build, run npm run build.

Then, by a computer with a python Gangster, try to connect two computers, use this Network,

Proceed as follows

1, two computers connected to the same network segment (to the same wireless phone) 
2, connected to two computers, the ping each other 
    as I ip 110.119.114.66 
        big brother 110.119.114.88 

    Win + R & lt - the - cmd , 
    each ping, ping me as the big brother of 
    
    ping 110.119.114.88 (they do not report overtime and the like, even if successful) 

3, configure my vue project 
    vue.config.js in 
    devserver: { 
       // before the 'localhost' to read as follows, the default port 8080 
        Host: "0.0.0.0",    
    }    

4 to start the project 
    npm run serve (if you did not turn over scripts, this is the start name) 

5, after a successful start, bigwigs access their computers 110.119.114.66 : 8080 

to

Small problems encountered during write:

Not connect my big brother, big brother said to be a firewall issue, deal with the next:

See   https://www.jb51.net/os/win10/300048.html

Echo requester 2, I do not know when to shut up

 

Then, in the Control Panel \ System and Security \ Windows Defender Firewall \ custom settings, in the two network firewalls are temporarily turned off,

Gangster Gada that can be a normal visit.

 

Summary, two points:

1. Configuration Host: "0.0.0.0",    
2, temporarily turn off the firewall

Guess you like

Origin www.cnblogs.com/-roc/p/12076415.html