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

"bun-repl" exited with code 1 #4617

Closed
vasergen opened this issue Sep 8, 2023 · 10 comments
Closed

"bun-repl" exited with code 1 #4617

vasergen opened this issue Sep 8, 2023 · 10 comments
Assignees
Labels
bug Something isn't working repl An issue with `bun repl`

Comments

@vasergen
Copy link

vasergen commented Sep 8, 2023

What version of Bun is running?

1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983

What platform is your computer?

Linux 5.15.0-82-generic x86_64 x86_64

What steps can reproduce the bug?

bun repl

What is the expected behavior?

should see repl

What do you see instead?

Internal REPL Error:
120 | }
121 | 
122 | // Note: This is a custom REPLServer, not the Node.js node:repl module one.
123 | class REPLServer extends WebSocket {
124 |     constructor() {
125 |         const server = serve({
                           ^
error: Failed to start server. Is port 3000 in use?
      at new REPLServer (/tmp/bun-repl@latest--bunx/node_modules/bun-repl/src/repl.ts:125:23)
      at /tmp/bun-repl@latest--bunx/node_modules/bun-repl/src/repl.ts:389:25
      at start (/tmp/bun-repl@latest--bunx/node_modules/bun-repl/src/repl.ts:386:16)
      at /tmp/bun-repl@latest--bunx/node_modules/bun-repl/src/cli.ts:36:6
 
This should not happen! Search GitHub issues https://bun.sh/issues or ask for #help in https://bun.sh/discord
error: "bun-repl" exited with code 1 (SIGHUP)

Additional information

It looks like when port 3000 in use the repl is failing to start, but port 3000 is very common port for js project. The better behavior would be to choose port that is not used at the moment and also not "common" one

@vasergen vasergen added the bug Something isn't working label Sep 8, 2023
@trnxdev
Copy link
Contributor

trnxdev commented Sep 8, 2023

Isnt bunx bun-repl a third party dependency?

Also, we cannot remove a process from port, so the owner of the dependency should consider fixing that or you can end the process which is running at port 3000 yourself.

We cannot solve problems in any dependency that are not bun (runtime) related, what if the owner of the dependency wants to explicitly port 3000?

(not trying to sound rude)

@vasergen
Copy link
Author

vasergen commented Sep 8, 2023

Isnt bunx bun-repl a third party dependency?

I have no clue about that to be honest, I just installed bun and run bun repl which is in one of the command from bun help so it looked to me a bun related

@irvile
Copy link

irvile commented Sep 9, 2023

This is not an official bun command. Did you install this package, right?

https://www.npmjs.com/package/bun-repl

@snaake20
Copy link

snaake20 commented Sep 9, 2023

image

@jhmaster2000
Copy link
Collaborator

Hey there, I'm the author of the bun-repl package, this is a little confusing at the moment so apologies for the confusion you're all having, but basically:

  1. bun-repl is a separate package yes, and started independently.
  2. It was planned to natively integrate it directly inside bun for 1.0.0, but due to timing constraints we couldn't finish the merge-in.
  3. So instead as a compromise the package was updated with the new features and an alias to bunx bun-repl was added as bun repl.
  4. Later on the merge will be finished and then it will be properly built-in.

So it is nearly-official now despite being on a separate package for now, so it's fine to open issues for it here too, I will be checking for them.

Now about the issue itself, yeah that's a good catch it was fine when it was just a small isolate package so I ended up forgetting it was using a hardcoded port, will be fixed soon (maybe today). Thanks for the report!

@jhmaster2000 jhmaster2000 self-assigned this Sep 9, 2023
@jhmaster2000
Copy link
Collaborator

@vasergen This should now be fixed (ref: jhmaster2000/bun-repl@53ae61c). bun repl should naturally start using the updated version after a little while.

It will now use a random free port chosen by Bun itself, optionally allowing the port to be customized with BUN_REPL_PORT env var if its set.

@Danger-Mkh
Copy link

today I just install the latest version of bun and after that I start using bun repl

and still get this message error: "bun-repl" exited with code 1 (SIGHUP)

@jhmaster2000
Copy link
Collaborator

@Danger-Mkh please see jhmaster2000/bun-repl#7 (comment)

@mirismaili
Copy link

I upgraded to bun-v1.0.2 and ran:

rm -rf /tmp/bun-repl@*

Then it was fixed. But then I get:

> 2+3
Internal failure due to global builtins tampering, this is not a bug but a temporary limitation of the REPL.
Please do not report this and avoid tampering with the global builtins in the REPL.
245 |                 console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
246 |                 this.fallbackBindingsPluginWarningDisplayed = true;
247 |             }
248 |             return fallbackBindings.transformSync(isModule ? JSON.stringify(src) : src, options);
249 |         }
250 |         throw new Error("Bindings not found");
                                               ^
error: Bindings not found
      at /tmp/bun-repl@latest--bunx/node_modules/@swc/core/index.js:250:44

@Danger-Mkh
Copy link

@Danger-Mkh please see jhmaster2000/bun-repl#7 (comment)

with this got fixed for me.

Thank You @jhmaster2000 .

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

No branches or pull requests

7 participants