0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

asdf + rubocop でエラーが出たとき

0
Posted at

ruby を新しいバージョンにして VSCode でコードを書いていたら、ファイル保存時に VSCode のターミナルにエラーが出ました。

Lint: executing rubocop -s '/home/mkt1234/Documents/prj/app/controllers/application_controller.rb' -f json...
Format: executing rubocop -s '/home/mkt1234/Documents/prj/app/controllers/application_controller.rb' -a...
No preset version installed for command rubocop
Please install a version by running one of the following:

asdf install ruby 3.2.1


or add one of the following versions in your config file at /home/mkt1234/.tool-versions

ruby 2.5.5
ruby 2.6.5
ruby 2.6.6
ruby 2.7.2
ruby 2.7.4
ruby 2.7.5
ruby 3.0.0
ruby 3.1.1

asdf で ruby 3.2.1 をインストールしたのに、もう一度インストールしろと言われる理不尽。

3.1.1 では rubocop を使えるのですが、昔 3.1.1 をインストールしたときに何をしたのか完全に忘れていたため、いろいろ試行錯誤した結果、ruby 3.2.1 の環境でふつうに rubocop をインストールし直せば良いと分かりました。

最初 VSCode の設定を疑っていて、だいぶ時間を使ってしまいました……

修正方法

mkt1234@DESKTOP:Documents/prj ‹main›$ ruby -v
ruby 3.2.1 (2023-02-08 revision 31819e82c8) [x86_64-linux]
mkt1234@DESKTOP:Documents/prj ‹main›$ gem i rubocop rubocop-rails
Fetching ruby-progressbar-1.13.0.gem
Fetching regexp_parser-2.8.0.gem
Fetching ast-2.4.2.gem
(以下略)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?