1

I'm new to ruby. I removed ruby 1.9 with sudo apt-get purge ruby and then I installed ruby 2.3.0 using ruby-install. But I got the following error

<internal:gem_prelude>:4:in `require': cannot load such file -- rubygems.rb (LoadError) from <internal:gem_prelude>:4:in `<internal:gem_prelude> 

when running rspec my_script.rb.

Still can't fix this after googling! Anyone can help me out?

2
  • did you install the gem rspec with the new ruby version (2.3.0) or it's already installed ? Commented Apr 18, 2016 at 15:57
  • @AbdooDev It's already installed Commented Apr 19, 2016 at 13:57

1 Answer 1

1

It seems that the rspec binary was only installed for your previous ruby version. Therefore it is found, but not guaranteed to work.

I'd recommend to use something like rvm (https://rvm.io/) or rbenv (https://github.com/rbenv/rbenv). Both of them can easily handle different ruby versions while maintaining dependencies (e.g. different load paths, different gem versions, etc.). I'd even use rvm if there is only one single ruby version installed on a system.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.