Running a vue.js project locally, how to change the default port for debugging?

Running a local vue.js project, how to change the default port for debugging?

Before I learned some knowledge and skills related to installation and use node.js, npm, , cnpm, etc., but when building the framework and developing, I will find that the port is occupied when testing the browser .webpackvue.jslocalhost:8080


How to customize and change the port number for debugging?

This is the purpose of writing this blog. One is to back it up, the other is to have experience-based reference and basis in future development, and the third is to serve as a cornerstone to “港大小白”attract others.

Closer to home, in fact, solving this problem is not as difficult as imagined.

Note: Default port: 8080;


For example: change the port number 8080 to 8081;


The following screenshots are used for reference. The screenshots are as follows:

write picture description here


Specific steps:

1. First, find the corresponding file according to the local path in the above figure C:\个人\vuejs\firstvue\config\index.js;
2. Secondly, find the corresponding red mark code above, directly modify the port number to 8081, and then complete the change of the default port of 8080;
3. Then, according to the old method, specify through cmd, and hot start the local corresponding project locally;
4. In the last step, open the browser and enter localhost:8081, you can see that the IP address bar has indeed been changed to port number 8081.

Note: The last step is sometimes executed automatically after you execute the cmd command instead of typing it manually localhost:8081.


Related article references:

serial number article title
1 How to install and uninstall node.js
2 How to install the Vue.js framework?
3 How to install multiple vue.js projects?
4 Questions about installation, uninstallation, and browser testing of node.js and vue.js?

以便于获取更多资源分享,请点击关注博主, the later important content will not be released directly, welcome to leave messages and comments, and will reply as soon as possible.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325173481&siteId=291194637