问题
When I try to run my deno file I got os error 10048
, How can I solve this error? Thank you
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}`)
I tried to Run my Deno file but I got this error
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/std@0.56.0/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
回答1:
You have another program listening on port 3000
, change the port to an unused one, or kill the program running on 3000
.
来源:https://stackoverflow.com/questions/62189026/deno-uncaught-addrinuse-only-one-usage-of-each-socket-address-protocol-network