oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.96k stars 2.75k forks source link

Failed to start debugger. Program could not be started. #9239

Open FreePhoenix888 opened 7 months ago

FreePhoenix888 commented 7 months ago

What version of Bun is running?

1.0.29+a146856d1

What platform is your computer?

Linux 6.1.75-060175-generic x86_64 x86_64

What steps can reproduce the bug?

  1. Open https://gitpod.new/
  2. Install bun
  3. Install bun extension
  4. Run any file by using Bun: Debug File command (Use F1 command pallete)
  5. See eror in debug console: Failed to start debugger. Program could not be started.

What is the expected behavior?

To debug the same way as local

What do you see instead?

Failed to start debugger. Program could not be started.

Additional information

No response

FreePhoenix888 commented 7 months ago

Note: If I run by using this gitpod template https://github.com/gitpod-samples/template-bun bun debugger works. I have no idea what I need to do to make it work without using that template. Do you have any idea?

agorischek commented 7 months ago

I'm seeing the same error message running in a GitHub Codespace

asynnestvedt commented 5 months ago

I had a working bun project and I started converting my codebase to typescript and now I have that error. too much code to revert and figure out the cause.

from VSCode Logs... Error: Invalid debug adapter at i.p (vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:1900:95)

eodeluga commented 5 months ago

Try a launch.json like this and have your entrypoint file be in src/app.ts or change the launch config to suit

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Program",
      "type": "bun",
      "args": ["run"],
      "request": "launch",
      "program": "src/app.ts",
      "stopOnEntry": false,
      "internalConsoleOptions": "openOnSessionStart"    
    },
    {
      "name": "Test Program",
      "type": "bun",
      "args": ["test"],
      "request": "launch",
      "program": "src/test/*.spec.ts",
      "stopOnEntry": false,
      "internalConsoleOptions": "openOnSessionStart" 
    },
  ]
}
liudonghua123 commented 4 months ago

Try a launch.json like this and have your entrypoint file be in src/app.ts or change the launch config to suit

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch Program",
      "type": "bun",
      "args": ["run"],
      "request": "launch",
      "program": "src/app.ts",
      "stopOnEntry": false,
      "internalConsoleOptions": "openOnSessionStart"    
    },
    {
      "name": "Test Program",
      "type": "bun",
      "args": ["test"],
      "request": "launch",
      "program": "src/test/*.spec.ts",
      "stopOnEntry": false,
      "internalConsoleOptions": "openOnSessionStart" 
    },
  ]
}

I tried this configuration, but it's the same. Only the following errors shown in debug console.

Failed to start debugger.
Program could not be started.
stellarbear commented 3 months ago

In my case the extension could not find bun runtime. I wish the error was more detailed.

I had to update settings.json file "bun.runtime": "/Users/....../.bun/bin/bun", To find the exact location (macos \ linux) which bun

pawk3k commented 3 months ago

Thanks @stellarbear , I had exactly same problem 👍

liudonghua123 commented 3 months ago

In my case the extension could not find bun runtime. I wish the error was more detailed.

I had to update settings.json file "bun.runtime": "/Users/....../.bun/bin/bun", To find the exact location (macos \ linux) which bun

I tested which bun in cmd, and it shown the following. I installed node via nvm and bun via npm i -g bun.

C:\Users\Liu.D.H>where bun
C:\Program Files\nodejs\bun
C:\Program Files\nodejs\bun.cmd

C:\Users\Liu.D.H>

I have also tried to config "bun.runtime" either "C:\Program Files\nodejs\bun.cmd" or "C:\Users\Liu.D.H\AppData\Roaming\nvm\v22.5.0\node_modules\bun\bin\bun.exe", I even copied bun.exe to some other location and configured, but none of them works for me. I didn't find more detailed logs about this problem.

loveloki commented 3 months ago

In my case the extension could not find bun runtime. I wish the error was more detailed.就我而言,扩展程序找不到bun运行时。我希望错误更详细。

I had to update settings.json file我必须更新 settings.json 文件 "bun.runtime": "/Users/....../.bun/bin/bun", To find the exact location (macos \ linux) 找到确切位置(macos\linux) which bun

This is can work on Javascript Debug Terminal in MacOS VSCode

mkdirJava commented 2 months ago

Could this be related to https://github.com/oven-sh/bun/issues/13071 @FreePhoenix888 Can you check vscode logs and see if there is a issue with perms about socket or assigned port? Might not be related but worth a lookie