node.js - 地址已在使用 :::8080 但端口未被任何进程使用
问题描述
我运行了这段代码:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World!');
}).listen(8080);
我收到以下错误:
Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle [as _listen2] (net.js:1290:14)
at listenInCluster (net.js:1338:12)
at Server.listen (net.js:1425:7)
at Object.<anonymous> (/home/dell/foo.js:6:4)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
Emitted 'error' event at:
at emitErrorNT (net.js:1317:8)
at internalTickCallback (internal/process/next_tick.js:72:19)
at process._tickCallback (internal/process/next_tick.js:47:5)
at Function.Module.runMain (internal/modules/cjs/loader.js:763:11)
at startup (internal/bootstrap/node.js:303:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:872:3)
因此,这是我调用的一些代码,以找出在终端端口上运行的进程:
❯ fuser 8080/tcp
~
但事实证明,该端口上没有运行任何进程。
我该如何解决?
(我是 node.js 的新手。我将不胜感激任何正确方向的帮助。)
解决方案
推荐阅读
- javascript - 如何重置角度4中的复选框
- makefile - Makefile for loop - 变量永远不会被设置
- riscv - 向 RISCV-32ima 添加新指令:“bad RISCV-opcode”
- copy - Redshift:COPY 命令针对具有 DEFAULT 值的 NOT NULL 列
- asp.net - 在 VisualStudio 项目中启动调试模式时未加载资源
- macos - Ckeditor 4.10 复制和粘贴在 MAC PRO 中不起作用 - 有什么解决方法吗?
- android - 当有人退出应用程序时如何运行方法?
- css - 制作一个像按钮一样样式的角度组件(Angular Material)
- python - 如何用 numpy/pandas 计算“子矩阵”条目的总和?
- c# - 在尝试仅获取文件的增量数据时获取重复内容和部分内容