Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to start server. Is port in use? #12127

Open
maxime-aubry opened this issue Jun 24, 2024 · 6 comments
Open

Failed to start server. Is port in use? #12127

maxime-aubry opened this issue Jun 24, 2024 · 6 comments
Labels
bug Something isn't working bun:http

Comments

@maxime-aubry
Copy link

What version of Bun is running?

1.1.16

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

I Have a NestJS project.

Here is the command to run project into package.json file :

"start:dev": "bun --watch ./apps/api/src/main.ts"

When i run this command, "bun start:dev api", I get this error :

[Nest] 23548  - 25/06/2024 00:11:05   ERROR [NestApplication] EADDRINUSE: Failed to start server. Is port 5000 in use? +7ms
175 |             this.httpServer.once('error', errorHandler);
176 |             const isCallbackInOriginalArgs = (0, shared_utils_1.isFunction)(args[args.length - 1]);
177 |             const listenFnArgs = isCallbackInOriginalArgs
178 |                 ? args.slice(0, args.length - 1)
179 |                 : args;
180 |             this.httpAdapter.listen(port, ...listenFnArgs, (...originalCallbackArgs) => {
                                   ^
EADDRINUSE: Failed to start server. Is port 5000 in use?
 syscall: "listen"

      at node:http:433:35
      at F:\Projets\shadow-hunters-web-api\node_modules\@nestjs\core\nest-application.js:180:30
      at new Promise (:1:11)
      at F:\Projets\shadow-hunters-web-api\node_modules\@nestjs\core\nest-application.js:170:16

Even if i change port number, i always get this error.

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@maxime-aubry maxime-aubry added bug Something isn't working needs triage labels Jun 24, 2024
@j-mcgregor
Copy link

if you're using Bun.serve then you have to specify the hostname next to the port number to set the port

@BennyAlex
Copy link

BennyAlex commented Nov 28, 2024

I also see this error on windows for a few days now.
Removing port from serve or setting a hostname does not change anything.

Image

I havent set port to 57151 (or 0)!

@BennyAlex
Copy link

BennyAlex commented Nov 28, 2024

seams windows related as it works on linux or inside WSL

@RiskyMH
Copy link
Contributor

RiskyMH commented Nov 28, 2024

@BennyAlex I believe your issue is #15425 and should also be fixed in canary:

bun upgrade --canary

@BennyAlex
Copy link

@BennyAlex I believe your issue is #15425 and should also be fixed in canary:

bun upgrade --canary

no its the same as the issue here.

@kravetsone
Copy link

I also see this error on windows for a few days now.
Removing port from serve or setting a hostname does not change anything.

Image

I havent set port to 57151 (or 0)!

It attach debugger if u bun run in vscode

use bunx kill-port 57151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working bun:http
Projects
None yet
Development

No branches or pull requests

5 participants