Ruby gems: Cannot load such file [duplicate] - ruby-on-rails

This question already has answers here:
new macbook - trying to run Rails, now I get "internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)"
(2 answers)
Closed 8 years ago.
Hi i'm trying to install some gems, but when I do i get the error
ERROR: Gem bundler is not installed, run gem install bundler first.
so when I do the command gem install bundler I get this:
:1:in require': cannot load such file -- rubygems.rb (LoadError)
from <internal:gem_prelude>:1:in'
It happens every time I try to do something with gems...I'm new at this, so I would appreciate some help...I've search a lot but instead of solving the problem I keep getting deeper

I'm having a similar problem when I try to install some gems, I think it is because rubygems.org is down.
Check this: "Could not find a valid gem in any repository" (rubygame and others)
Check tomorrow if you can install it.

Related

Ruby failing to run after upgrading (sqlite3_native LoadError); sqlite3 not upgrading properly

I have upgraded to ruby 2.5.0 but I am having conflicts everywhere. I have checked previous posts on stack overflow such as:
Ruby on Rails - "Add 'gem sqlite3'' to your Gemfile"
cannot load such file — sqlite3/sqlite3_native
cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails
https://github.com/sparklemotion/sqlite3-ruby/issues/137
But none of them are working for me. My issue is similar to these posts in that after I run rails server after a long error message the last few lines read:
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in 'block in require'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in 'require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
I have tried creating a new project, reinstalling sqlite3 through gem and minigw itself, reinstalling rails and ruby. I have tried most of the instructions in the previous questions but nothing works. SQLite3 version 3.25.2, Ruby 2.5.3, rails 5.2.1
Sorry, this might be a simple fix but I am a complete beginner to ruby and I have been trying different things for a few hours now. Any help is appreciated.
As explained in this answer https://stackoverflow.com/a/49736971/4685144, you should now be able to install sqlite3 using git:
gem 'sqlite3', git: 'https://github.com/sparklemotion/sqlite3-ruby'
Then bundle install

cannot load such file — sqlite3/sqlite3_native (LoadError) on ruby on rails

2.5.1 Ruby, 5.2.1 Rails versions. Everything is installed from scratch. Im trying to create a project in RubyMine, and this error pops up right from the start, and i can do nothing untill this error is solved.
This solution didnt work for me:
cannot load such file -- sqlite3/sqlite3_native (LoadError) on ruby on rails
Couldnt make to the end of this solution:
An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue
on 5-th step after execution of "configure" promt says that no acceptable c compiler found in PATH.
Help please.
So it seems that there are some problems with compability on this versions of ruby, rails, and sqlite. I've installed rails installer with 2.3.3 ruby and 5.1.6 rails, and error dissapeared.

rails new my app failed

I followed the steps on installing ruby on https://gorails.com/setup/ubuntu/14.10
I tried the command rails new app
but I keep on getting this error Help!!
/home/paulydee/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in require': cannot load such file -- rails/cli (LoadError)
from /home/paulydee/.rvm/rubies/ruby-2.2.3/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:inrequire'
Is your problem the same as this one? If so, install rails by calling gem install rails

Rails App - with pg database - errors with setup

I am in rails setup hell.
I tried to make an app 2 years ago and after endless problems with it, I tried to make a fresh app and start again. I"m now having the same problem I had the first time around in getting the pg database setup, but none of the solutions offered for the first problem are working this time. My post about the problem the first time is here: Installing PG gem on OS X - failure to build native extension
Currently - I'm getting this error:
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that gem install pg -v '0.18.4' succeeds before bundling.
I have tried uninstalling and reinstalling pg. I have tried installing with home-brew. I have tried all of the suggestions in the previous post I wrote about this problem with my first app. I've tried the solutions in this post:
Ruby/PgSQL error on Rails start : cannot load such file -- pg_ext (LoadError)
Each time, the gem installs correctly. It's just I can't start the server or do anything from the command line - this error keeps coming up.
One of the steps I tried involved adding this to my command line. It's a straight copy & paste. I don't know what it means. I'm wondering if its a source of my issue:
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin
When I try:
rake rails:update:bin
I get this error:
rake aborted!
LoadError: cannot load such file -- nokogiri/nokogiri
Does anyone know how to solve this problem? I'm in rails hell!
A similar issue is occur by a user. Please have look to this link. Hope this may helpful!!
Error message: Make sure that `gem install pg -v '0.18.1'` succeeds before bundling

`require': no such file to load -- sqlite3/sqlite3_native (LoadError)

Trying to get ruby on rails 1.8.7 working on windows but when i start rails server i get this error:
`require': no such file to load -- sqlite3/sqlite3_native (LoadError)
I have tried copying the 3 files and putting them in ruby/bin but it doesnt help as mentioned at the bottom of this post: http://www.ruby-forum.com/topic/216270
Any ideas?
Found the solution on this post's comments http://www.shaunambrose.com/2010/08/05/how-to-fix-a-sqlite3-dll-missing-error-message-in-ruby-on-rails/comment-page-1/#comment-15965
"The problem seems to be that the sqlite3 gem is compiled with version 3.7.3. I downloaded and set up version 3.7.3 instead and it now works just fine."
Get it here: http://www.sqlite.org/sqlitedll-3_7_3.zip
Uncomment the line “gem ‘sqlite3-ruby’, :require => ‘sqlite3′” and comment the line “gem ‘sqlite3′” in your Gemfile
While I was trying to play around Amazon Linux, I too faced the same
"/usr/local/share/ruby/gems/2.0/gems/sqlite3-1.3.10/lib/sqlite3.rb:6:in
`require': cannot load such file -- sqlite3/sqlite3_native
(LoadError)"
Since everything was already setup on my local, I tried debugging.
The issue apparently is the library is missing in
/usr/local/share/ruby/gems/2.0/gems/sqlite3-1.3.10/lib/sqlite3/
If you go to this path, you will see that sqlite3_native.so is not present.
What I did was simply, ran a locate sqlite3_native.so and copied it to the location.
I faced the same issue with all other libraries in Amazon Linux, including nokogiri and nodejs.

Resources