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 activate Ruby environment: spawn /bin/sh ENOENT #1887

Closed
CermakM opened this issue Apr 5, 2024 · 11 comments
Closed

Failed to activate Ruby environment: spawn /bin/sh ENOENT #1887

CermakM opened this issue Apr 5, 2024 · 11 comments
Labels
bug Something isn't working

Comments

@CermakM
Copy link

CermakM commented Apr 5, 2024

Description

Hi!

I am new to ruby and I am trying to run ruby-lsp in VSCode. However, I am unable to do that, ending up with the following error:

Screenshot 2024-04-05 at 8 07 16

I am pretty sure my SHELL env is set to /bin/zsh. I tried checking the codebase and executing

/bin/zsh -ic 'rbenv exec ruby -rjson -e "puts JSON.dump(ENV.to_h)"'

the SHELL is set correctly.

I have .ruby-version file in the repo containing 3.3.0.

When running ruby-lsp in the terminal, I am not sure if the output is correct:

Ruby LSP> Running bundle install for the custom bundle. This may take a while...
Ruby LSP> Command: (bundle check || bundle install) 1>&2
Resolving dependencies...
The Gemfile's dependencies are satisfied

Even when waiting for quite some time, this is the only output I get.

BIG thanks for any help! ❤️

Reproduction steps

The only thing I did is installing rbenv and installing the ruby-lsp VScode extension.

I am running the latest version of VScode on MacOS M3. Tried to switch even to the pre-release version of the extension but the issue stays the same.

Code snippet or error message

Failed to activate rbenv environment: spawn /bin/sh ENOENT
@CermakM CermakM added the bug Something isn't working label Apr 5, 2024
@thuandohoang
Copy link

I also got the same issue. After I install an older version (0.2.2), and then reinstall the newest one, the issue has gone.

@CermakM
Copy link
Author

CermakM commented Apr 9, 2024

@thuandohoang What do you mean by version 0.2.2? Afaik the most recent version of the ruby-lsp extension is v0.5.17?

@CermakM
Copy link
Author

CermakM commented Apr 9, 2024

I also tried the asdf version manager instead of rbenv and I get the same error message (just replace rbenv for asdf) 🤷

@thuandohoang
Copy link

@thuandohoang What do you mean by version 0.2.2? Afaik the most recent version of the ruby-lsp extension is v0.5.17?

@CermakM I mean downgrade version of the extension. You can see the steps here

@CermakM
Copy link
Author

CermakM commented Apr 11, 2024

@thuandohoang That's interesting! I downgraded it to 0.2.2 and it indeed works! However, when I upgrade it back, I get a different issue when starting Ruby LSP 😆 🤷

Cannot create property 'identifier' on string 'asdf'

@thuandohoang
Copy link

@thuandohoang That's interesting! I downgraded it to 0.2.2 and it indeed works! However, when I upgrade it back, I get a different issue when starting Ruby LSP 😆 🤷

Cannot create property 'identifier' on string 'asdf'

haha, i have no idea with this issue 😄

@gottlike
Copy link

Same with me.. suddenly it stopped working after the latest update of the extension in VSC. Getting:

2024-04-12 11:59:50.859 [error] Activating extension Shopify.ruby-lsp failed due to an error:
2024-04-12 11:59:50.859 [error] TypeError: Cannot create property 'identifier' on string 'rbenv'
	at set versionManager [as versionManager] (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:44:57823)
	at Pa.activateRuby (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:44:58002)
	at Ia.start (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:47:2301)
	at Aa.activateWorkspace (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:54:7155)
	at async Aa.activate (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:54:6014)
	at async FD (/Users/erik/.vscode/extensions/shopify.ruby-lsp-0.5.18/out/extension.js:55:539)
	at async a.n (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:6237)
	at async a.m (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:6200)
	at async a.l (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:142:5657)

@santosral
Copy link

On your settings.json on VScode. This was updated from string to object.

// Previous
"rubyLsp.rubyVersionManager": "asdf"
// New
"rubyLsp.rubyVersionManager": { "identifier": "auto" }

@gottlike
Copy link

If I just delete this line, it works again!

@vinistock
Copy link
Member

The new error is a bug in the latest version, which will be fixed by #1923 and not related in any way to the original issue.

@CermakM are there any logs in the output tab under the Ruby LSP channel?

@vinistock
Copy link
Member

Closing this for now. If the issue is still occurring in v0.7.1, please let us know.

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

No branches or pull requests

5 participants