I'm having an issue with VSCode on Ubuntu. I have the ruby extension and the ruby-rubocop extensions installed but when I run the rubocop extension on save, I get 2 errors
- rbenv: version '2.5.1' is not installed (set by RBENV_VERSION environment variable)
- command /home/{username}/.rbenv/shims/rubocop returns empty output! please check configuration.
My project is using ruby version 2.7.6 installed via rbenv. 2.5.1 is an old version of ruby I had installed which I since removed. I don't understand why VSCode is trying to use version 2.5.1. When I run rubocop via a bash shell, it runs as expected. rbenv local
and rbenv global
are all set to 2.7.6
and my project as a .ruby-version
file with 2.7.6 set.
When I run echo $RBENV_VERSION
in a bash shell, I get nothing returned, but if I run this in a terminal shell within VSCode, it returns 2.5.1.
How do I get VSCode to use the correct rbenv version?