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
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
Related
So my gemfile specifies ruby '2.6.3' and I used rbenv to install ruby 2.6.3. However, when I try to run rake db:create, it gives me an "Your Ruby version is 2.7.0, but your Gemfile specified 2.6.3" error. I even check my ruby version using ruby -v and it even tells me I have 2.6.3. Can someone explain why this is occurring?
Yesterday I updated my Ruby version to 2.6.5 with rbenv, but today I had a problem when I wanted to update Rails to 6.0.2.1.
It didn't work well.
This is what I have:
echo $PATH
/usr/local/opt/ruby/bin:./bin:./node_modules/.bin:/Users/paulinedussart/.rbenv/shims:/Users/paulinedussart/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/Users/paulinedussart/.rvm/bin
ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin19]
which ruby
/usr/local/opt/ruby/bin/ruby
I did:
gem install rails
I got:
Successfully installed rails-6.0.2.1
Parsing documentation for rails-6.0.2.1
Done installing documentation for rails after 0 seconds
1 gem installed
then rbenv rehash.
When I ran which rails or which -a rails I got:
/usr/bin/rails
To check if everything was ok I ran rails --version but the result was:
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
but I did not do that.
Somewhere I saw this instruction
ls `rbenv prefix`/bin
to check if Rails was there but it doesn't appear:
bundle bundler erb gem irb rake rdoc ri ruby
Finally, when I run gem list rails I get:
*** LOCAL GEMS ***
rails (6.0.2.1)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0)
sprockets-rails (3.2.1)
I obviously closed the terminal at a different step of the config but without success.
I'm sure there is a problem with folders but I don't know how to fix this to put the gem rails in the correct one.
Does somebody have an idea?
Try this:
Switch to Ruby 2.6.5:
rbenv global 2.6.5
Install the Bundler gem:
gem install bundler
Install Rails:
gem install rails
Try using: rbenv rehash.
Also you can check "Rails is not currently installed on this system - High Sierra #1106".
I had the same issue and I refered to this issue and found we don't need:
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
You just need:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
if you install it via Homebrew.
I'm trying to bundle install a ruby project in Git Bash but I'm getting the above message.
ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [i836-mingw32]
gem -v
2.3.0
New to Ruby so its really frustrating. I'm trying to do the project below
http://www.viralrails.com/?p=25
This happens because you are specifying a Ruby version in your Gemfile (2.3.0) and this version is not installed or is not the current or default version.
Don't remove the line ruby '2.3.0' as someone said above. You app may have dependencies to this version. Do the following:
1) Check if you have Ruby 2.3.0 installed. If you are using rvm this may be done by
rvm list
and if you are using rbenv by
rbenv versions
2) If you don't have this Ruby version in your list of installed versions, then install it by issuing the following command
rvm install 2.3.0
and if you are using rbenv by
rbenv install 2.3.0
3) If you already had Ruby 2.3.0 installed or completed step 2 above, enter your app directory and issue the following command
rvm use 2.3.0
and if you are using rbenv by
rbenv local 2.3.0
Then run
bundle install
and I believe things will be ok.
Hope it helps!
Install bundler after installing ruby 2.4.0.
gem install bundler
If you installed bundler before installing ruby 2.4.0 then you should reinstall bundler or update it.
Also if the above command didn't work.
gem update bundler
I'm in a local repository running the command
bundle install --without production
and I get an error message saying
Your Ruby version is 2.0.0, but your Gemfile specified 2.2.2
I just installed Ruby version 2.2.2 and using the gem environment command I'm able to see I have version 2.2.2 however, ruby -v gives me
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
I have tried adding 2.2.2 to my .ruby-version file in the root directory, as well as updating the bundler and typing bundle exec rails s
but it still gives me the same error.
I am following this backbone rails turotial.
The tutorial says they are using Ruby 1.9.2 and rails 3.0.3.
I am using Ruby 1.9.3, and I created an rvm gemset for this tutorial and installed rails 3.0.3 into the gemset.
I ran bundle install which installed mysql2 version 0.3.11
When I ran rake db:create I got this error:
WARNING: This version of mysql2 (0.3.11) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
So I ran:
gem uninstall mysql2
gem install mysql --version 0.2
rake db:create
Then I got this error:
Could not find mysql2-0.3.11 in any of the sources
Try running bundle install.
If I run bundle install it takes me back to the first problem.
Not sure what the I should try next.
place in Gemfile
gem 'mysql2','0.2.7'
then run
bundle install