0

I am a beginner Rails developer and I kept encountering this problem when I tried to do "rails server" on the command prompt, I keep getting an error:

"in 'require': cannot load such file -- nokogiri/nokogiri (LoadError)"

I searched online and apparently nokogiri is currently not supported for Ruby 2.2.2 (the version I am currently using).

I am currently working in Ruby 2.2.2, Rails 4.2.3, and gem v. 2.4.8 on a Windows 8.1 PC.

Is there anything I can do to circumvent this problem? Right now, I'm thinking the easiest way would just be to downgrade to Ruby 2.1.6 and go from there. Would anyone be willing to tell me just how to do that? I used RubyInstaller but I don't know if installing Ruby 2.1.6 on top of Ruby 2.2.2 would mess anything up in my system. Is there a way to automatically downgrade anything?

Thanks in advance and if there's another easier way other than downgrading please let me know!

P.S. I tried downgrading the gem version and then I realized that it doesn't actually change the Ruby version.

firesage123
  • 21
  • 1
  • 3
  • 2
    i use ruby 2.2.2 and nokogiri 1.6.1 but on os x. From experience, doing rails on windows is a pain mainly because some important gems are for *nix environment only. Like me, you will run into a wall and simply won't be able to program further (like unicorn, foreman, etc). Consider using vagrant or switch to os x or linux. It might be hard at first, but it will pay off in the long run – Nick Ginanto Jul 27 '15 at 17:25
  • Have a look at http://stackoverflow.com/questions/28985328/rubyinstaller-2-2-1-and-rails-rake-cannot-load-nokogiri/ which has some insights on how to get nokogiri to run with ruby 2.2.2 on Windows. – Bruno E. Jul 27 '15 at 20:10
  • Same or similar problems with bcrypt. I consider settting up a Linux VM just for RoR development. Less hussle than fighting these bugs/features. – Jannis Alexakis Aug 01 '17 at 07:39

1 Answers1

0

You can just delete the folder 2.2.2 was installed and re-install the older version. Just double check the PATH variable if it correctly points to the re-installed ruby path.