Unable to install rails

Alright, so I’m back. After successfully upgrading from 26->28->30, I am now trying to install Rails. I am following this guide: Ruby on Rails — Fedora Developer Portal
I have successfully installed Ruby (can view in screenshot)
ruby_works_may22

However, when I try to run this command: gem install rails, I first get that I need to run it with sudo, so I run: sudo gem install rails and I run into this problem:
gem_install_rails_may22

So I try: gem update --system but run into permissions error. But, as advised in this post (https://discussion.fedoraproject.org/t/gem-update-system-returns-undefined-method-source-paths/1502/2), it is not recommended to run gem update --system with sudo:
gem_update_system_may22

Unfortunately, I am stuck. I have tried totally uninstalling ruby and the gems and starting completely over but I arrive at this exact problem. I am not sure how to move forward.

Also, if it’s helpful
rpm -qf /usr/bin/gem
and
rpm -qi rubygems
returns the following output:
rpm_output_may22

The version of Fedora I am running is Fedora 30.

Have a look at:

gem help install

in particular:

--[no-]user-install          Install in user's home directory instead of GEM_HOME. 
1 Like

Okay, ended up reading more of the man pages for gem. Thank you for your suggestion/hint - it pushed me in the right direction :slightly_smiling_face:. I found a solution that didn’t involve the
--[no-]user-install
though. The last answer on this SO post helped me out: https://stackoverflow.com/questions/35549385/rails-error-method-missing-undefined-method-this-for-gemspecification
Specifically, I ran this command:
sudo gem update --system 2.5.0 --no-ri --no-rdoc
which ran successfully. After completion of this command, I was able to successfully run
sudo gem install rails

Ahh also, to verify that the installation process completed as expected, I just ran
rails new app which successfully ran and was able to run rails s and get the dummy app up and running.

Maybe this is the solution but is not easy Why not just follow this procedure:

rubygem-rails.noarch : Full-stack web application framework

sudo dnf install rubygem-rails

NOTE:

before install a gem be sure is can be install it via dnf:

dnf search gem needed | grep rubygem

Regards.,

1 Like

This is incredibly helpful. Though I did not use it in this situation, I will be using this in the future. Thank you!