-1

I just created a ruby on rails project and I'm trying to generate a model with the command rails generate model Car and I'm getting this error:

~/Code/CarInfo (master) $ rails generate controller Test
rbenv: version `ruby-2.3.7' is not installed 

I tried updating and reinstalling rbenv with homebrew but it still doesn't work and I'm still getting the same error.

When I type ruby -v in the cli I am getting the same error as shown above.

3limin4t0r
  • 19,353
  • 2
  • 31
  • 52
  • Did you also view the [installation instructions](https://github.com/rbenv/rbenv#homebrew-on-macos) and run `rbenv init`, and follow the remaining installation instructions. – Jay Dorsey Apr 03 '19 at 20:51
  • Yes! And now im getting ```Ignoring bindex-0.6.0 because its extensions are not built. Try: gem pristine bindex --version 0.6.0 Ignoring bootsnap-1.4.2 because its extensions are not built. Try: gem pristine bootsnap --version 1.4.2 Ignoring byebug-11.0.1 because its extensions are not built. Try: gem pristine byebug --version 11.0.1 /Library/Ruby/Gems/2.3.0/gems/bundler-2.0.1/lib/bundler/spec_set.rb:87:in `block in materialize': Could not find nokogiri-1.10.2 in any of the sources (Bundler::GemNotFound)``` –  Apr 03 '19 at 21:34
  • Try `which ruby`, `which gem`, and `which bundler` and post your results. Also, try `gem install bundler`. I suspect you've got ruby configured, but it's pointing back to the default "system ruby" version of bundler (because of the path in the error) – Jay Dorsey Apr 04 '19 at 12:59

1 Answers1

2

rbenv lets you switch between versions of ruby, but it doesn't install those versions for you. I'd suggest also installing ruby-build (which works with rbenv). Once you've done that, you should be able to run rbenv install 2.3.7 and fix your issue.

jerhinesmith
  • 15,214
  • 17
  • 62
  • 89