Skip to content

Commit 46cdbc0

Browse files
committed
feat: 优化端口异常解决方案
1 parent dbd60fa commit 46cdbc0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/plugins/factory/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ module.exports = async function(api, info = {}) {
2323

2424
const portfinder = require('portfinder');
2525

26-
const _port = process.env.PORT || port || await portfinder.getPortPromise({
27-
port: 3000, // minimum port
28-
stopPort: 3333, // maximum port
26+
const startPort = parseInt(process.env.PORT || port || 3000);
27+
const _port = await portfinder.getPortPromise({
28+
port: startPort, // minimum port
29+
stopPort: startPort + 300, // maximum port
2930
});
3031

3132
const _host = process.env.HOST || host || '0.0.0.0';

0 commit comments

Comments
 (0)