Rails Errors

Darrick Pang
2 min readApr 23, 2021

There has been times that Rails will not work because of errors, and I get frustrated that I feel like I am pulling my hair out. Sometimes these things happen because we pulled the code from GitHub or there is a corrupted file or something else. Before I get into the error, I use a Windows 10 OS with Ubuntu as a subsystem.

One error I got was

Traceback (most recent call last):
11: from /home/darrickpang/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>'
10: from /home/darrickpang/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
9: from /home/darrickpang/.rvm/gems/ruby-2.6.1/bin/bundle:23:in `<main>'
8: from /home/darrickpang/.rvm/gems/ruby-2.6.1/bin/bundle:23:in `load'
7: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/exe/bundle:13:in `<top (required)>'
6: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/exe/bundle:13:in `require_relative'
5: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler.rb:10:in `<top (required)>'
4: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler.rb:10:in `require_relative'
3: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler/rubygems_ext.rb:13:in `<top (required)>'
2: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler/rubygems_ext.rb:14:in `<module:Gem>'
1: from /home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler/rubygems_ext.rb:17:in `<class:Specification>'
/home/darrickpang/.rvm/gems/ruby-2.6.1/gems/bundler-2.2.16/lib/bundler/rubygems_ext.rb:17:in `remove_method': method `source' not defined in Gem::Specification (NameError)

when I tried to run bundle install. Anything related to bundle will get this error. From the bottom, we see that the “method ‘source’ is not defined”. Open the gem file and we see from the first line is the source where the app will download the gems from

source 'https://rubygems.org'. 

I suspect this error is saying that the app cannot download the gems from the website due to a corrupt file. One solution that was suggested to me by someone at my software boot camp was

rvm uninstall 2.6.1
rvm reinstall 2.6.1.

After I tried these, bundle install is back to normal for me.

Since we are discussing RVM’s, let’s briefly look into them. RVM is shorthand for Ruby Version Manager and it is used in a Unix OS installs different Ruby and gem versions in different directories. The commands I use are in the

home/darrickpang

directory. Once a directory is selected, we can install a Ruby version there and the gems as well.

In conclusion, I had issues finding a solution to this error because it seems it was not a common one. For those who saw this error, I hope this solution helps you fix it.

References

  1. https://medium.com/@moulayjam/whats-an-rvm-and-why-you-should-use-it-for-rails-apps-b5cced2469a8

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response