'No such file' error after reinstalling Ruby - ruby-on-rails

At first I could not create a new Ruby project and I was getting a error about the bin path. I uninstalled ruby and reinstalled it.
Now I get this error whene executing rails --version:
mackbookpro:desktop 411techhelp$ rails --version
/usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7:in `require': no such file to load -- rubygems (LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p392/bin/ruby_noexec_wrapper:7
What is going on and how can I fix this?

It looks very much like uninstalling ruby also uninstalled rubygems, but you didn't re-install the latter (or your installation of rubygems is/was for a different ruby version).

Related

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.

sqlite3.rb:6:in require: libruby.so.2.2: cannot open shared object file

sorry for my english.
I was learning about ruby on rails and i tried to update to rails 5.
I uninstall olders version of ruby and now i have problems.
i have reading http://railsapps.github.io/updating-rails.html
i made a mistake because i uninstalled something that i dint do.
now i have ruby-2.3.1
i have this error now.
.gem/gems/sqlite3-1.3.11/lib/sqlite3.rb:6:in `require':
libruby.so.2.2: cannot open shared object file: No such file or
directory -
/home/yvasquez/.gem/gems/sqlite3-1.3.11/lib/sqlite3/sqlite3_native.so
(LoadError)
Thanks for reply
I had the same error with ruby 2.3 & 2.3.1. It is because it fails to recognize the devkit (which i hope you need not install unless you're using Windows) gems as native ruby gems. The problem is with the latest ruby version and the gem configs located in the directory, where you will have to manually specify the native part to each gem.
Anyway, I went back to ruby 2.2.5, and everything works perfectly for me.
Try ruby 2.2.5 OR since you are on linux, try re installing and make sure you add everything to the path so your gems are recognized. Also, try installing sqlite3 separately and add to path.

I deleted some old versions of gems and now rails is broken

So long story short I was running out of room on my dual booted ubuntu laptop. I decided to delete some older versions of gems to make some room which worked. Great, except now I can't get rails to work on my machine anymore - rails console and rails server is failing. This is the error I see when I type in rails s;
jmtoporek#jmtoporek-laptop:~/rails/pskr2$ rails s
/home/jmtoporek/.rvm/gems/ruby-1.9.2-p180/gems/hpricot-0.8.6/lib/fast_xs.so: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
/usr/bin/rails: line 104: 4807 Aborted /usr/bin/ruby /usr/share/rails/railties/bin/rails ${OVERWRITE_OPTION} "${RAILS_PKG_DESTINATION}" "${INTERNAL_OPTIONS}" -d $DATABASE
ln: target `/home/jmtoporek/rails/pskr2/s/vendor/' is not a directory: No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/vendor/rails': No such file or directory
ln: creating symbolic link `/home/jmtoporek/rails/pskr2/s/doc/api': No such file or directory
I suppose reinstalling rails should be enough, because it installs several gems to run properly. Simply run gem install rails and see if it works again.
Also, if you use RVM, you can use a different installation executing something like this:
rvm use ruby-1.9.3-p286#rails328 --create --default
..and then, installing rails again:
gem install rails
Just remember this last solution requires you to install all other gems as well.
I reinstalled railties - despite the fact that the gem was already installed something must have gotten messed up. I reinstalled railties, which fixed the issue. I wish I had looked closer at the error message. It appears that there is a copy of railties inside the rails gem directory.

After upgrading Ruby1.9.2 from p180 to p290, libruby dynamic library path isn't updated

I used RVM to upgrade Ruby 1.9.2 from patch level p180 to p290:
rvm upgrade 1.9.2-p180 1.9.2-p290
Then, I used these commands to update my Rails gem and other gems
gem install rails 3.0.5
gem update
Everything seems to be fine; rvm info shows all Ruby binaries and gems have been moved to the correct p290 path (~/.rvm/*/ruby-1.9.2-p290/*).
However, when I go to my Rails application directory and issue the command rails console, I get the error message saying a gem (activesupport-3.0.5) cannot load the libruby.1.9.1.dylib file.
10:30 AM ~/Development/rails_projects/my_app_0515 $ rails console
/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': dlopen(/Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle, 9): Library not loaded: /Users/whk/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (LoadError)
Referenced from: /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
Reason: image not found - /Users/whk/.rvm/gems/ruby-1.9.2-p290/gems/serialport-1.0.4/lib/serialport.bundle
. . .
Rails can't find the dylib file in ~/.rvm/rubies/ruby-1.9.2-p180/lib, because the p180 path no longer exists, but the file is in ~/.rvm/rubies/ruby-1.9.2-p290/lib.
From a separate StackOverflow post, I found a workaround is adding this line to .bashrc
export DYLD_LIBRARY_PATH="/Users/whk/.rvm/rubies/ruby-1.9.2-p290/lib:$DYLD_LIBRARY_PATH"
However, I want to understand why the rvm ruby upgrade doesn't take care of the lib path change? Does anyone know a cleaner solution -- one that removes the p180 path from where it is configured?
Here are my environment:
Mac OS X 10.6.6 (Snow Leopard)
rvm 1.8.4
ruby 1.9.2p290
Rails 3.0.5
Thanks!
the problem was in gems native extension - their were nto rebuild during rvm upgrade 1.9.2-p180 1.9.2-p290 - next time please have closer look on the output ... it should give your information what's wrong.
as for this particular use case it shoudl be enough to reinstall the given gem:
gem install serialport -v 1.0.4
... not sure if it should be uninstalled first

SQLite3 stopped working

I have been working on an ruby app for a while, and today starting up my server via "rails server" I now get this:
/Users/Ross/rails_projects/splash/json/ruby/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
What I changed before this, was I installed the curb and json gems. The funny thing is it still works on Heroku, just not my local machine. So it must be environmental. However, I cannot figure out what broke and why.
Still stuck, noticed if I load up irb:
MacBook-Pro:splash Ross$ irb
ruby-1.9.2-p136 :001 > require 'sqlite3'
=> true
ruby-1.9.2-p136 :002 >
So why does that work and not the rails server? I even tried to reinstall rails. Nothing. Path issue?
Update: Still not working, tried another of solutions: building from source, uninstall, reinstall, upgrade rails, etc. The message has changed slightly:
/Volumes/Macintosh HD/Users/Ross/rails_projects/splash/json/ruby/1.9.1/gems/sqlite3-1.3.3/lib/sqlite3.rb:6:in `require': no such file to load -- sqlite3/sqlite3_native (LoadError)
I really need help, this is really killing my productivity.
Try this, install homebrew and rvm as per my blog post here.
$ rvm --default 1.9.2
It'll spit out a comment giving you the install command to grab the latest ruby. Then repeat the above command to set it. You can test this by doing
$ ruby -v
It should show you something similar to the following, although I'm using 1.8.7
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.2.0]
Now simply reinstall rails gem install rails and do bundle install. By using rvm, and hopefully a newer version of ruby, it'll setup a whole new space for you to test out a new deploy. Hopefully you won't get the same issue again. Keep us posted :)
Thanks for the response Mike. Funny thing was it didn't work. After I did it, I got a message about curl was missing. So I installed it and the sqlite3 error popped up immediately again.
A ton more Googling and I found an post about installing sqlite3 through RVM.
so I did a:
rvm gem install sqlite3
then I did:
rm -rf .bundle && bundle install
Then it started working. I'm not sure if it was the deleting the bundle or installing through rvm, but either way it's working again.

Resources