Help With Ruby/Nokogiri/Rails compatability

I am having a problem getting RoR to work on my laptop. It used to work fine but I haven’t used rails in about a year or more and now I want to build a project. When I used the rails new project command it created the project with the warning that nokogiri could not load because of my outdated ruby version, so I spent time updating it and when i use the rvm list known in the terminal I can see I have ruby 3.0.0 and ruby 2.7.2 and when I use the command rvm use ‘ruby x.x.x’ it tells me that version is not on my computer and must be downloaded.

Then all of a sudden the console stopped working in the terminal it tells me. that the spring preloader is running already when it isnt.

And now it tells me that rails is not on my computer but it is.

I just want to get back to a working environment. I’ve searched all over the web for answers and have been screwing around in the terminal with various commands to get things. to work but I cant.

Now when I try to install rails it tells me to update to a version of ruby greater than 2.4 but I already have versions greater than that I just can’t get the cpu to use the right version and I tried every rvm command. I’m wondering if erasing everything and going for a clean stall isn’t the best thing.

If anyone can help me get up and running with rails again I’d be very grateful.

I haven’t used rvm in 10 years, but I think you should first of all ensure to pick the correct Ruby version:

rvm use 3.0.1 --default

once you’ve done that, check it was set with ruby -v (and ensure it will always pick the same version), make sure you have Rails installed for this version:

gem install rails

(I think with rvm you can also install gemsets for projects, but I have no experience with that, and don’t think it is necessary as we have bundler nowadays.)

Now with the latest Ruby and a current Rails version, running:

rails new my_app_name --skip-spring --skip-action-cable

(the options are only giving as an example, run rails new --help to see the full list)

should create a new folder my_app_name, setup a new Rails app in there and run bundle install for you, to install all dependencies.

If you ever again get the error message that some gem or command like rails is not installed, or your Ruby version would be too old, ensure you are using the right Ruby version first:

rvm use 3.0.1

before trying the command again.

1 Like