How do I configure VSCode's launch.json to debug? (Heroku + Node.js)

Viewed 164

How do I do a VSCode launch.json so I can run heroku local and attach it to the debugger?

/
├── .vscode
│   ├── launch.json
│   └── settings.json
└── app-sample
    ├── node_modules
    ├── .env
    ├── .gitignore
    ├── index.js
    ├── Procfile
    ├── package-lock.json
    └── package.json

I can use "$heroku local" to attach to VSCode's debugger.

reference

https://devcenter.heroku.com/articles/heroku-local

output

% heroku local web
Debugger attached.
Debugger attached.
[OKAY] Loaded ENV .env File as KEY=VALUE Format
14:24:59 web.1   |  Debugger attached.

However, when I try to launch it with VSCode's launch.json setting, the following error is output.

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Heroku local",
      "runtimeExecutable": "heroku",
      "runtimeArgs": [
        "local"
      ],
      "cwd": "${workspaceFolder}\\app-sample",
      "envFile": "${workspaceFolder}\\app-sample\\.env"
    }
  ]
}

output

/opt/homebrew/bin/heroku local
Error: spawn /opt/homebrew/bin/heroku ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:465:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
0 Answers
Related