我在安装和尝试使用 ruby-lsp 时遇到问题。
我认为我遵循了正确的步骤,但不断出现错误:
❯ rbenv versions
system
2.7.4
3.1.3
* 3.1.4 (set by /Users/myuser/.rbenv/version)
3.2.1
3.2.2
❯ gem install ruby-lsp
Successfully installed ruby-lsp-0.8.0
Ignoring debug-1.7.2 because its extensions are not built. Try: gem pristine debug --version 1.7.2
Parsing documentation for ruby-lsp-0.8.0
Done installing documentation for ruby-lsp after 0 seconds
1 gem installed
❯ gem list ruby-lsp
*** LOCAL GEMS ***
ruby-lsp (0.8.0, 0.7.6, 0.4.4)
重述,以防万一(
rbenv rehash
)
运行:
❯ ruby-lsp
rbenv: ruby-lsp: command not found
The `ruby-lsp' command exists in these Ruby versions:
3.2.2
我不明白为什么它只出现在 Ruby 的一个版本中。
有什么想法吗?
谢谢
只是缺少一个设置:在之前的安装中,我的
PATH
变量中没有 Gem bin 路径,因此通过将其添加到 .bashrc
文件中解决了我的问题:
# $GEM_HOME already defined
export PATH=$PATH:$GEM_HOME/bin