const portfinder = require('portfinder');
const port = await portfinder.getPortPromise();
两行代码

端口搜索范围

默认情况下,portfinder将开始搜索8000并扫描,直到达到最大端口号(65535

 

 

源码的路径是在node_modules/@vue/cli-service/lib/commands/serve.js

相关文章:

  • 2021-10-26
  • 2021-07-23
  • 2021-08-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-13
  • 2021-06-01
  • 2021-07-30
  • 2021-09-05
  • 2021-07-11
  • 2022-01-18
相关资源
相似解决方案