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.
Related
I have Ruby 2.7.2 and Rails 6.1.3.1 installed on my Ubuntu 20.04 machine. However, when I try to test a ruby command using the command below:
irb
a = 1
I get the error below:
/home/mycomputer/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.3.5/lib/irb/ruby-lex.rb:50:in block in set_input': undefined method in_pasting?' for Reline::ANSI:Class (NoMethodError)
I am still tryring to fix it, but it's working.
The error was caused by an issue with the reline gem in the Ruby 2.7.2 setup. However, if I switch to another Ruby version (2.6.6) using rbenv global 2.6.6 everything seems to work fine.
Here's how I fixed it:
Solution 1:
Since the reline gem comes with Ruby installations, we will uninstall the ruby 2.7.2 version that is the cause of the issue using rbenv :
rbenv uninstall 2.7.2
Next, reinstall the ruby 2.7.2 version that is the cause of the issue using rbenv :
rbenv install 2.7.2
Afterwhich you will install the version of Bunder and Rails that you are using. In this case, my Rails version is Rails 6.1.3.1:
gem install bundler
gem install rails -v 6.1.3.1
rbenv rehash
You can afterwards, check the version of ruby, bundler and rails that were installed using the command below:
ruby -v
bundler -v
rails -v
This time when you try to test again using irb it should work fine.
Solution 2:
A faster approach will be to uninstall the reline gem in the Ruby 2.7.2 setup using the command below:
gem uninstall reline
And then reinstall it:
gem install reline
Note:
I did not test this to confirm if it fixes the issue.
That's all.
I hope this helps
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 try to install skylinecms but I have a problem with installing the gem.
The gem factory_girl asked me to use version> = 1.9.2 of Ruby
atmoner#atmoner:~/base_ror$ sudo gem install skylinecms
ERROR: Error installing skylinecms:
factory_girl requires Ruby version >= 1.9.2.
ruby -v
atmoner#atmoner:~/base_ror$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
I have tried to change ruby version to 1.9.2
atmoner#atmoner:~/base_ror$ rvm use 1.9.2
Using /home/atmoner/.rvm/gems/ruby-1.9.2-p320
But still same problem
atmoner#atmoner:~/base_ror$ sudo gem install skylinecms
ERROR: Error installing skylinecms:
factory_girl requires Ruby version >= 1.9.2.
what's the source of this problem?
you have an idea?
You shouldn't use sudo with rvm, as it creates a new subshell with a completely new environment. See more about sudo and rvm here: RVM and 'sudo'
Most likely your system ruby version is 1.8.7, and that is what is getting invoked when you run sudo gem install skylinecms. You can verify that with the following commands:
rvm use system
ruby -v
Try installing the skylinecms gem without sudo.
Best to use per-project gemsets as suggested in rvm best practices
Somehow my rails installation hides itself successfully...
I have:
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
rvm 1.10.0-pre
gem 1.8.10
and I try to install rails:
sudo gem install rails
it works fine:
Successfully installed rails-3.1.3
1 gem installed
Installing ri documentation for rails-3.1.3...
Installing RDoc documentation for rails-3.1.3...
when I do:
rails - v
I get
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails
Also, when I do
rake
in a rails app root directory, I get:
Missing the Rails gem. Please `gem install -v= rails`, update your
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version
you do have installed, or comment out RAILS_GEM_VERSION to use the
latest version installed.
executing
gem install -v= rails
raises an error:
ERROR: While executing gem ... (ArgumentError)
Illformed requirement ["="]
So apparently it is sitting somewhere and cannot be seen by my environment. I guess installing via apt-get is not an option as I don't want to confuse gem...
Any ideas?
Cheers
Mac
Do not use sudo.
Just gem install rails
Use RVM instead of the packaged ruby/gems distribution. http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
I just installed RoR 3 with sudo gem install rails. I tried this multiple times, but every time I run $ rails I get an error and I hate it:
imac:~ rsonic$ rails
/Users/rsonic/.gem/ruby/1.8/bin/rails:19:in `load': no such file to load -- rails (LoadError)
from /Users/rsonic/.gem/ruby/1.8/bin/rails:19
How can I fix this? I want to use Rails again!
1.Install rvm(Ruby version manager)
sudo gem install rvm
2.Go to install path of rvm and do
rvm-install
3.Check if the install was successful by running
rvm
4.Check for current version of ruby
ruby -v
5.Install ruby 1.9.2 using rvm
rvm install 1.9.2
6.User ruby 1.9.2 with the help of rvm do
rvm 1.9.2
(you can switch back to system's default ruby version by running command >rvm system)
7.Install gems using rvm do
rvm gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
This will install gems locally for ruby1.9.2 without touchin the sytem ruby
8.Install RAILS3 beta release
rvm gem install rails --pre
9.Install railties which are required for RAILS3
rvm gem install railties --pre
10.For generating a new app with RAILS3 skeleton now do
rails myapp
Note all ruby script/ commands have changed to rails *
e.g: RAILS<3
ruby script/server -p 3004
RAILS3
rails server -p 3004
Hope it helps...