Shopify / ruby-lsp

An opinionated language server for Ruby
https://shopify.github.io/ruby-lsp/
MIT License
1.36k stars 125 forks source link

Failed to setup the bundle: spawn bundle ENOENT #1559

Closed tombohub closed 1 year ago

tombohub commented 1 year ago

Vscode: 1.76.2 OS: Win10 rubyLSP: 0.2.3

Installed in VSCode and did not start,, this is the error:

image

Tried to troubleshoot, followed steps then this error:

image

this is the folder tree:

image

vinistock commented 1 year ago

Did you add the .ruby-version file after the warning? Have you tried restarting? Is there anything in the output tab under the Ruby LSP channel?

saimageshvar commented 1 year ago

Facing similar issue. Using VS Code attached with a container. The Ruby LSP Channel shows the following

>> Running `bundle install`...
>> `bundle install` exited with code -2
johannlejeune commented 1 year ago

Having the exact same issue with the same output in the Ruby LSP channel with VSCode attached to a container (Dev Containers extension). Tried restarting, same error. Tried running

BUNDLE_GEMFILE=/path/to/your/project/.ruby-lsp/Gemfile bundle install

manually (with the right path to the Gemfile, of course), ruby-lsp gem installs properly but it still fails with the same error in the output channel when trying to restart.

guledali commented 1 year ago

@vinistock You can try the extension with rails docked to see if it actually works https://github.com/rails/docked

tombohub commented 1 year ago

Did you add the .ruby-version file after the warning? Have you tried restarting? Is there anything in the output tab under the Ruby LSP channel?

I installed the extension then followed the troubleshoot. Right now I opened the same project which already has .ruby-version file and got the error: image

I restarted VScode, yes.

Where do I see Ruby LSP channel?

output is empty: image

I added chruby part, now getting another error. Here is the whole screenshot: image

vinistock commented 1 year ago

Is your .ruby-version file empty like it is in the screenshot?

If that's the case, you need to specify a version there (e.g.: 3.2.1). And if this is the case, we'll need to improve that error message for when .ruby-version is empty.

tombohub commented 1 year ago

@vinistock yes, it's empty. Reason is that I didn't know I need to put anything inside. I'm beginner and just wanted to check out ruby in vscode. Thanks

I have put version and now having this error:

Failed to activate chruby environment: Command failed: 
undefined -lic 'chruby "3.1.3" && ruby --disable-gems -rjson 
-e "printf(%{RUBY_ENV_ACTIVATE%sRUBY_ENV_ACTIVATE}, JSON.dump(ENV.to_h))"' 
'undefined' is not recognized as an internal or external command, operable program or batch file.

screenshot:

image

vinistock commented 1 year ago

It looks like your SHELL environment variable is not set. But given that you're using Windows, I don't think chruby supports it, does it? I think it requires bash or zsh to be your shell.

If you're using Windows, I believe Shopify/ruby-lsp#1571 will help Windows users activate the right Ruby version more easily.

guledali commented 1 year ago

Where is the guide for people running ruby through docker

tombohub commented 1 year ago

using Windows, I don't think chruby supports it, does it? I think it requires bash or zsh to be your shell.

I am not sure, I am really not familiar with ruby ecosystem. So none of these version managers magers support Windows?:

image

In that case I have to wait Shopify/ruby-lsp#1571

andyw8 commented 1 year ago

Sidenote: There are multiple approaches to running Ruby on Windows. If you use WSL then you will can have access to all the standard tools:

https://learn.microsoft.com/en-us/windows/wsl/install

janbiedermann commented 1 year ago

See https://github.com/Shopify/ruby-lsp/pull/620 and https://github.com/Shopify/vscode-ruby-lsp/pull/546

Fixes this issue

guledali commented 1 year ago

How do you make the extension work if you're running ruby through a docker environment?

vinistock commented 1 year ago

@guledali this issue is about a different problem. For container related things, can you please see if https://github.com/Shopify/ruby-lsp/issues/1552 solves the issue or post a comment there?

My understanding is that using the official remote extension allows you to connect VS Code to containers and then any extension should just run seamlessly.

vinistock commented 1 year ago

I just released v0.2.5 which includes some relevant fixes for Windows. If you'd like to try it, you should set your version manager to none. Please report back if more issues come up.

tombohub commented 1 year ago

Hi, I've tried, but have this error, what does it mean?

image

vinistock commented 1 year ago

Apparently, on Windows you'll need custom activation. It will be solved by Shopify/ruby-lsp#1571.

vinistock commented 1 year ago

Version v0.3.0 includes the new custom activation. Please try the instructions and report back if any problems persist.