ruby-lsp: command not found: rbenv

Description

Instantly when starting VSCode and extensions are starting up I get an error telling me that the rbenv command can’t be found. It worked on Friday, but today it’s not and I’m not sure what could be wrong. ¯\(ツ)/¯

rbenv was installed via Homebrew and is up to date. All my extensions is up to date.

Image

Ruby LSP Information

The Collect Ruby LSP Information for Issue Reporting is not working. Nothing happens.

Reproduction steps

  1. Start VSCode with Ruby LSP installed.
  2. Get error.

Code snippet or error message

Automatic Ruby environment activation with rbenv failed:
Command failed: rbenv exec ruby -W0 -rjson -e 'STDERR.print("RUBY_LSP_ACTIVATION_SEPARATOR" + { env: ENV.to_h, yjit: !!defined?(RubyVM::YJIT), version: RUBY_VERSION, gemPath: Gem.path }.to_json + "RUBY_LSP_ACTIVATION_SEPARATOR")'
zsh:1: command not found: rbenv

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (9 by maintainers)

Most upvoted comments

I opened #2824 to give the same solution we used for Shadowenv a shot. I’d still want to understand how we get into this situation, but I’m hopeful that the PR will fix the problem.

I’ve got the same issue. rbenv is loaded in .zshrc with:

if [ -d "$HOME/.rbenv" ]; then
  export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
  if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi
fi

And it’s working in a regular VS Code terminal window (i.e., rbenv version returns the right Ruby version for this project).