Vue-cli starts the local service. The reason why the local service cannot be accessed through ip address in the LAN is vue-cliip.

Source: Internet
Author: User

Vue-cli starts the local service. The reason why the local service cannot be accessed through ip address in the LAN is vue-cliip.

1. Problem description:

A new vue-cli project has been developed. If you want to view the effect on your mobile phone, you will find that the access fails. The ip address and port number are correct, but the mobile phone number cannot be accessed. You cannot enter the same ip port number in the browser of your computer, it can only be accessed through localhost: 8080. Other mobile phones and computers on the same LAN cannot access and debug through IP addresses,

2. cause: the vue-cli project is generated with one click through the command line. The local debugging mode is generated by default in the configuration file, and the default access address is localhost: 8080.

3. method of correction

Find the index. js file in the config folder and Modify host: "localhost" TO host: "0.0.0.0". At this time, the mobile phone and other computers in the same LAN can view the page through ip + port number.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.