获取可用端口号NodeJS2025/02/10 19:22const { execSync } = require('child_process') /** * 获取可用端口号,如果当前端口号已被占用,则自增,直到找到可用端口号为止 */ const getAvailablePort = port => { let targetPort = port while (true && tar ...
获取可用端口号NodeJS2025/02/10 19:22const { execSync } = require('child_process') /** * 获取可用端口号,如果当前端口号已被占用,则自增,直到找到可用端口号为止 */ const getAvailablePort = port => { let targetPort = port while (true && tar ...