Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

OSX Failed to launch delve with this error Error: spawn /usr/local/bin/dlv ENOENT #466

Closed
jkhelil opened this issue Sep 1, 2016 · 13 comments

Comments

@jkhelil
Copy link

jkhelil commented Sep 1, 2016

I ma using vscode 1.4.0, and trying to launch delve for go debugging
I get this log from the console
messageService.ts:119Failed to continue: "Error: spawn /usr/local/bin/dlv ENOENT": Error: Failed to continue: "Error: spawn /usr/local/bin/dlv ENOENT"
at Object.C [as create](file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:34:19570)
at file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:105:21677
at Object.m [as _notify](file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:8153)
at Object.B.enter (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:11658)
at i.Class.define._run (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:12979)
at i.Class.define._chainedError (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:12338)
at i (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:10161)
at i.Class.define.then (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:13788)
at Object.P.enter (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:10230)
at i.Class.define._run (file:////Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:30:12979)

Any help would be greatly appreciated. Thanks!

@rosspeoples
Copy link

The only time I've ever seen this error is when VSCode was opened in something other than their $GOPATH folder (workspace), or the configuration in $GOPATH/.vscode/launch.json points to the wrong folder.

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Oct 11, 2016

@jkhelil Can you check if the discussion in #332 helps? It arrives at the same conclusion as @deejross

Basically, ensure that in your launch.json, you have set the program attribute to the right folder

@ramya-rao-a
Copy link
Contributor

@jkhelil @mrichman Do you still see this issue or fixing launch.json has fixed this for you?

@mrichman
Copy link

I had to replace ${workspaceroot} with the absolute path to my project. In this case, "program": "/Users/mrichman/go/src/github.com/mrichman/myapp/cmd/myapp/main.go"

@ramya-rao-a
Copy link
Contributor

@mrichman You can use ${workspaceroot} instead of typing out the whole absolute path as well.
For example in your case you can set

"program": "${workspaceroot}/cmd/myapp/main.go"

instead of

"program": "/Users/mrichman/go/src/github.com/mrichman/myapp/cmd/myapp/main.go"

Assuming that you have opened /Users/mrichman/go/src/github.com/mrichman/myapp in VS Code

@ramya-rao-a
Copy link
Contributor

Closing this as we havent heard back anything recently.

@eureka-gh
Copy link

eureka-gh commented Feb 8, 2017

I have the same issue, it looks that changing ${workspaceroot} to full path will resolve this type of error, however, the following error that I have is shown below:

2017/02/08 21:56:23 server.go:73: Using API v1
2017/02/08 21:56:23 debugger.go:66: launching process with args: [/Users/hgao/projects/p4/hgao-mbp_ap3_streams/services/auth-service/src/dolby.com/ap3/cmd/auth/debug]
could not launch process: could not fork/exec
Process exiting with code: 1

Do you guys have any idea on that?

@ramya-rao-a
Copy link
Contributor

@eureka-gh Delve errors out withcould not launch process: could not fork/exec if there are issues with code signing/certificates.

See https://github.com/Microsoft/vscode-go/wiki/Debugging-Go-code-using-VS-Code#could-not-launch-process-could-not-forkexec

@ramya-rao-a
Copy link
Contributor

@mrichman @eureka-gh Another thing I just noticed, there is a casing issue. ${workspaceroot} won't work. ${workspaceRoot} is the right token to use.

@eureka-gh
Copy link

eureka-gh commented Feb 8, 2017

@ramya-rao-a, Thanks for your prompt response to my question.

I followed a couple of solutions mentioned in provided link. It turns out that the "could not fork/exec" issue can be resolved by using "sudo -E"(preserve env) in CLI, but how to launch the dlv debugger in VS code with "sudo -E" ?

Not so sure, if you can give me some hints on that ?

Many thanks!

@ramya-rao-a
Copy link
Contributor

Where did you get the suggestion to use sudo? None of the linked items #717, #269 or https://github.com/derekparker/delve/issues/357 suggest using sudo.

"could not fork/exec" is always associated with code signing issues.

All the linked items talk about clean installing delve again

@eureka-gh
Copy link

@ramya-rao-a Sorry for not going though all your resources. I opened two many searching pages and totally lost. Now I am able to use dlv to debug my go code in VS code. I removed previous dlv which was installed by "go get " and reinstall new dlv with "brew install go-delve/delve/delve" which is pointed out at https://github.com/derekparker/delve/blob/master/Documentation/installation/osx/install.md

It turns out "github.com/derekparker/delve" is NOT a good way to install dlv on OSX.

Thanks for your support. It's very helpful.

@ramya-rao-a
Copy link
Contributor

glad that you are unblocked @eureka-gh, Happy Coding!

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants