Deno Uncaught AddrInUse:通常只允许每个套接字地址(协议/网络地址/端口)使用一种。 (操作系统错误10048)

问题描述 投票:0回答:1

[当我尝试运行我的Deno文件时,我得到了os error 10048,如何解决此错误?谢谢

 import { Application } from 'https://deno.land/x/oak/mod.ts'

const app = new Application();
const port = 3000;

app.use((ctx) => {
    ctx.response.body = "Hello World"
})

app.listen({ port })
console.log(`localhost:${port}`)

我尝试运行我的Deno文件,但出现此错误

D:\Deno Documentation\deno3>deno run --allow-net ./server.js
localhost:3000
error: Uncaught AddrInUse: Only one usage of each socket address (protocol/network address/port) is normally permitted. (os error 10048)
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.listen ($deno$/ops/net.ts:51:10)
    at listen ($deno$/net.ts:152:22)
    at Application.serve (https://deno.land/[email protected]/http/server.ts:252:20)
    at Application.listen (https://deno.land/x/oak/application.ts:295:20)
    at file:///D:/Deno%20Documentation/deno3/server.js:10:5
deno
1个回答
0
投票

您有另一个程序正在侦听端口3000,将端口更改为未使用的端口,或杀死正在3000上运行的程序。

© www.soinside.com 2019 - 2024. All rights reserved.