我试过:
netstat -tupln
这是结果:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:5001 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:4445 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:8126 0.0.0.0:* LISTEN -
最佳答案
如果您有权访问您的代码,只需转到 server.js
或您使用的任何文件名。那里提到了端口号。你可能会发现类似的东西
const port = process.env.APP_PORT || 80;
app.set('port', port);
const server = http.createServer(app);
关于node.js - 如何找到 NodeJS 使用的端口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54593417/