user17914516
user17914516

Reputation: 169

Rubocop command not found in ruby 3.0.3

I am trying to run rubocop on ruby 3.0.3 console

 rubocop

and I am getting the following.

rbenv: rubocop: command not found

The `rubocop' command exists in these Ruby versions:
  2.3.3
  2.5.1
  2.5.3
  2.6.5
  2.7.0

Upvotes: 3

Views: 7327

Answers (1)

Drenmi
Drenmi

Reputation: 8777

If you want to use RuboCop as a "naked" command from anywhere, you need to install it in your system gems:

gem install rubocop

Ruby needs to install the gems for each Ruby version independently.

If you are using bundler, and in a project that has RuboCop installed from its Gemfile, you can invoke that particular version using bundler:

bundle exec rubocop

Upvotes: 9

Related Questions