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

Problem running extension in devcontainer. #1552

Closed
zewelor opened this issue Mar 27, 2023 · 6 comments
Closed

Problem running extension in devcontainer. #1552

zewelor opened this issue Mar 27, 2023 · 6 comments
Labels
needs-more-info More information is needed to address this issue transferred This issue was transferred from vscode-ruby-lsp

Comments

@zewelor
Copy link

zewelor commented Mar 27, 2023

Hi

I'm using devcontainer, with Ruby LSP extension version 0.2.2. When starting I get following error:

Failed to activate none environment: Command failed: ruby --disable-gems -e 'puts "#{RUBY_VERSION},#{defined?(RubyVM::YJIT)}"' /bin/sh: ruby: not found

Screenshot_20230327_141555

When I run new terminal window, inside container via devcontainer, I can execute this command without problem:

/app $ which ruby
/usr/local/bin/ruby
/app $ ruby --disable-gems -e 'puts "#{RUBY_VERSION},#{defined?(RubyVM::YJIT)}"'
3.1.3,constant

How can i debug it further ?

@vinistock
Copy link
Member

If the extension couldn't find Ruby, then the version manager activation probably failed. Are you using any version managers?

@zewelor
Copy link
Author

zewelor commented Mar 27, 2023

Hi

thanks for the reply. On the host I'm using asdf, and have it configured in Ruby LSP as default. When opening project without devcontainer it works fine.
Inside container, using vscode devcontainer I'm not using any version manager.

EDIT: Added info in first post, that console output is from the container shell.

@vinistock
Copy link
Member

I'm not exactly sure how devcontainers work. I believe what's happening is that the Ruby LSP is trying to use the configuration manager (asdf) in the devcontainer, but it's not available there and then it fails.

Is Ruby available by default in the container's path? Maybe you can try to use none as the version manager and see if the right Ruby gets picked up.

@zewelor
Copy link
Author

zewelor commented Mar 27, 2023

Ruby is available in the containers path ( I'm using official Ruby Docker Image ). I'm using none as version manager already ( in remove devcontainer ). Vscode allows to set different settings for devcontainer.

When I try to change to asdf, inside devcontainer I got other error.
/bin/ash -lic 'asdf exec ruby --disable-gems -rjson -e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"' /bin/ash: can't access tty; job control turned off /bin/ash: asdf: not found

I will try to find some more info about devcontainers.

@vinistock vinistock added the needs-more-info More information is needed to address this issue label Mar 30, 2023
@vinistock
Copy link
Member

I think the official Remote extension could potentially be what you're looking for. My understanding is that it allows connecting to a remote machine / devcontainer and then VS Code just works as if it were running inside the remote machine.

@zewelor
Copy link
Author

zewelor commented Apr 6, 2023

From what I understand this remote extension works for ssh only. I've tested latest version 0.2.4 and now I've got one less error. I assume work around ruby activation when none package manager is chosen fixed this. Now I have the same error as here: #1572 . So I'm closing this hoping fixing linked issue will make everything working in my case also.

@zewelor zewelor closed this as completed Apr 6, 2023
jayanth-kumar-morem referenced this issue in jayanth-kumar-morem/vscode-ruby-lsp Apr 26, 2023
Refactor code actions to use context instead of our own cache
@vinistock vinistock added the transferred This issue was transferred from vscode-ruby-lsp label Mar 12, 2024
@vinistock vinistock transferred this issue from Shopify/vscode-ruby-lsp Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-more-info More information is needed to address this issue transferred This issue was transferred from vscode-ruby-lsp
Projects
None yet
Development

No branches or pull requests

2 participants