最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

如何找到哪个端口使用的NodeJS?

IT培训 admin 3浏览 0评论

如何找到哪个端口使用的NodeJS?

我试着用:

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);

如何找到哪个端口使用的NodeJS?

我试着用:

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);
发布评论

评论列表 (0)

  1. 暂无评论