libffi.so.8: cannot open shared object file - ruby-on-rails

I upgraded Rails to 7.0.1. When I do the rails g controller Pages home, it's giving the error:
>>rails g controller Pages home
/home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require': libffi.so.8: cannot open shared object file: No such file or directory - /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so (LoadError)
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi.rb:5:in `rescue in <main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/ffi-
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-2.4.0/lib/sassc.rb:31:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootstrap-5.1.3/lib/bootstrap/engine.rb:4:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-2.4.0/lib/sassc/native.rb:3:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/sassc-rails-2.1.2/lib/sassc/rails.rb:5:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bundler-2.3.5/lib/bundler.rb:176:in `require'
from /home/shadman/instagram/config/application.rb:7:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:22:in `require_application!'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command/actions.rb:14:in `require_application_and_environment!'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands/generate/generate_command.rb:21:in `perform'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/command.rb:48:in `invoke'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/railties-7.0.1/lib/rails/commands.rb:18:in `<main>'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from /home/shadman/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/bootsnap-1.10.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from bin/rails:4:in `<main>'
Any idea how to fix this?

You can compile ffi gem with internal libffi that comes with it. Make sure the version matches:
gem install ffi --version "1.15.5" -- --disable-system-libffi
I don't know why ffi compiles fine with system libffi, but then refuses to run with it.
Update (not a solution, just some debugging)
The culprit for me was linuxbrew. I didn't have libffi.so.8 so it was weird that ffi was expecting it for some reason:
$ fd "libffi.so" /usr
/usr/lib/x86_64-linux-gnu/libffi.so.7.1.0
/usr/lib/x86_64-linux-gnu/libffi.so
/usr/lib/x86_64-linux-gnu/libffi.so.7
When ffi is compiling it's checking for libffi and ffi.h and other things. You can do it in irb:
>> require "mkmf"
>> pkg_config("libffi")
=> ["-I/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/include ", "-L/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/../lib", "-lffi"]
I assume this is because pkg-config is coming from linuxbrew:
$ which -a pkg-config
/home/linuxbrew/.linuxbrew/bin/pkg-config
/usr/bin/pkg-config
/bin/pkg-config
$ pkg-config --libs libffi
-L/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/../lib -lffi
$ /bin/pkg-config --libs libffi
-lffi
But that never came up in any searches I tried before. Well, derp, it's a hidden directory:
$ fd -H "libffi.so" /home/linuxbrew
...
/home/linuxbrew/.linuxbrew/Cellar/libffi/3.4.4/lib/libffi.so.8
# there it is ^
So during configuration and compilation ffi finds everything it needs, seems to point to the correct lib locations, which makes it compile just fine. But when it runs, it can't find it:
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
linux-vdso.so.1 (0x00007ffea8b22000)
libruby.so.3.1 => /home/alex/.rbenv/versions/3.1.2/lib/libruby.so.3.1 (0x00007f5d04ba8000)
libffi.so.8 => not found
...
If I take linuxbrew out of my path it compiles and runs fine with libffi.so.7 that I have through apt:
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
...
libffi.so.7 => /lib/x86_64-linux-gnu/libffi.so.7 (0x00007fdcaa104000)
...
I don't know how dynamic libraries actually work, to explain it. It links to non-standard libruby.so.3.1 location from rbenv just fine.
As another workaround, symlinks solve everything:
$ cd /usr/lib/x86_64-linux-gnu
$ sudo ln -s /home/linuxbrew/.linuxbrew/lib/libffi.so.8
$ ldd /home/alex/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/ext/ffi_c/ffi_c.so
libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007f03de9ee000)

Most probably you need to install libffi. On CentOS/RHEL/Fedora systems you will need to execute:
sudo dnf -y install libffi

When I was working on a rails project I realized there was a difference in versions between the system and project one thus my solution was matching the two:
gem uninstall ffi
gem install ffi -v 1.15.0 -- --disable-system-libffi
Ubuntu version (20.04)

Update my ubuntu from 20.04 to 20.10 and install Ruby version 3.0.2 and Ruby On Rails version 7.0.0 .
That solved the error.

Related

I can't install zsh with Homebrew

OS X El Capitan version 10.11.2
I attempted brew update, but this error message is displayed.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:15:in `<main>'
I also attempted brew install zsh, but the above message is displayed.
Please let me know how to fix this error message.
Found an answer which worked for me here: https://stackoverflow.com/a/35495897/1354137
The problem mainly occurs after updating OS X to El Capitan (OS X 10.11). This is mainly because of file permission issues with file El Capitan’s new SIP process. Try changing permissions of /usr/local directory.
$ sudo chown -R $(whoami):admin /usr/local
If it still doesn't work, use following steps and everything will be fine. This may be because homebrew is not updated.
1. open terminal
2. $ cd /usr/local
3. $ git reset --hard
4. $ git clean -df
5. $ brew update

Windows/Ruby/Rails install --- .cannot load such file -- sqlite3/sqlite3_native windows

Ruby 2.1.3p242 <2014-09-19 revision 47630> [x64-mingw32]
Rails 4.2.0.beta2
I'm running windows 8 on a 64 bit system. I have been using c9 (cloud hosted ubuntu) but want to start using RubyMine IDE on my pc to make everything faster but it's posing some problems.
I've tried pretty much every recommended way including this one:
How do I install sqlite3 for Ruby on Windows?
but I'm still getting the same error message. You help is much appreciated! Please let me know if you have any questions for me.
Full Error message when I run $rails s:
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:233:in `load_dependency'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/activesupport-4.2.0.beta2/lib/active_support/dependencies.rb:248:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/sqlite3-1.3.9-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:76:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:72:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:72:in `block in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:61:in `each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler/runtime.rb:61:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.7.4/lib/bundler.rb:133:in `require'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/config/application.rb:7:in `<top (required)>'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.0.beta2/lib/rails/commands.rb:17:in `<top (required)>'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/bin/rails:8:in `require'
from C:/Sites/aynulhabib-habib-framework-aca42deddccd/bin/rails:8:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
fortunately, you don't have to switch to ruby 2.0
there is a solution to this issue, after endless trying...
https://github.com/hwding/sqlite3-ruby-win
Steps
Pre
gem uninstall sqlite3 --all
Source
Download the latest sqlite3-ruby, https://github.com/sparklemotion/sqlite3-ruby
unzip the package
Build
run command-line in the extracted dir
make sure you have your C compiler installed and added to PATH
gem install bundler
bundle install
rake native gem
you'll find a dir named 'pkg' generated
Install
enter dir 'pkg'
gem install --local sqlite3-xxx.gem ('xxx' is version code)
Check
irb
require 'sqlite3'
The issue is that binary sqlite3 gem do not include pre-compiled versions for Ruby 2.1.3
This is mentioned in the sqlite3-ruby mailing list here.
In the folder of your project open terminal and execute:
bundle update sqlite3
bundle update nokogiri
I hope i have helped you ;)
EDIT:
i always recommend using linux/mac for ruby, because some gems may get problematic, because of compiling errors with c
always use bundle to manage your gems, it is much easier*,
you can install it by:
gem install bundler
bundle install - will install all the gems in your Gemfile
the last bundler version is not compatible withe ruby bellow 2.3, so use gem install bundler -v 1.16.4
If you have extracted "exe"s and "dll"s from Sqlite download link to Ruby's bin folder and still have this problem. Try this:
bundle update
gem uninstall sqlite3
Given a choice between multiple versions of sqlite3, choose last option 'All versions'. Enter last number here
Select gem to uninstall:
1. sqlite3-1.3.13
2. sqlite3-1.3.13-x64-mingw32
3. All versions
>3
.
.
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
>
y
gem install sqlite3 --platform=ruby
rails s
This should work.
Read through this link for more explanation if above works for you.

Mac OSX 10.10 Yosemite - Rake aborted! LoadError: cannot load such file -- iconv

It seems that my ruby version auto updated to 2.0.0 after I upgraded my OSX to Yosemite.
It failed me when I tried to do
rake db:migrate
My application supports version 1.9.3 and I am uncertain that is the cause of such error.
$ rake db:migrate --trace
rake aborted! LoadError: cannot load such file -- iconv
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `require'
/Users/jinqyu/Documents/Chocolicious/config/application.rb:5:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/jinqyu/Documents/Chocolicious/Rakefile:4:in `<top (required)>'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:687:in `raw_load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:94:in `block in load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:93:in `load_rakefile'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:77:in `block in run'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Library/Ruby/Gems/2.0.0/gems/rake-10.3.2/lib/rake/application.rb:75:in `run'
/usr/bin/rake:37:in `<main>'
I found few links installing ruby 1.9.3 but I don't know which one to use.
I followed a guide from http://www.curvve.com/blog/guides/2013/install-ruby-1-9-3-mac-osx-10-8-macports-rvm/
However, I can't even run the first command
$sudo port selfupdate -v
after installing macPort. It says command not found.
Any ror warriors has the same problem as me and had solved it? Please help!
Downgraded ruby version to 1.9.3 and the app works fine! HOORAY!
So apparently the version is the cause of such error.
Here's the steps I took to resolve the error, open your terminal.
Install RVM with a Ruby, copy & paste:
$ \curl -sSL https://get.rvm.io | bash -s stable
$ rvm get head
Install Ruby
$ rvm use --install 1.9.3
Bundle install & rake:db
$ bundle install
$ rake db:migrate
Tell me if it solves your problem. I might missed out some steps after trying many other solutions that I found online.
p/s: you might have to install homebrew beforehand. cheers! :)
source: https://github.com/wayneeseguin/rvm/issues/3099
In order to resolve it, please add the following gem in the gem file, it would help you from being downgraded.
gem "iconv", "~> 1.0.3"

Rails console: in `require': cannot load such file -- readline (LoadError)

I've got some errors in my Rails app and I'm trying to start the Rails console by issuing following command:
rails console
No matter what I try, I'm always getting the same error:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I've really tried every possible solution I found on the net, as many people encounter the same error. Unfortunately, nothing seems to work. When I try the following command:
ruby /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb
I get following output
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
*** /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb failed ***
Indicating that something is missing, but installing readline with apt-get doesn't make a difference either. I'm guessing it could have something to do with incompatible gem versions, as the console worked briefly some time ago. Are there any known version issues with readline? Very much people seem to have encountered problems with this gem.
Try putting rb-readline in your Gemfile and check this out https://stackoverflow.com/a/9595841/1905235
If you are running Rails 4.x it is possible that Spring is causing this issue.
Try stopping the Spring process bundle exec spring stop
Then run bundle exec rails c
I finally found a solution. It was a conjunction of several issues (gem versions, conflicting readline libraries).
Firstly, I refetched the readline lib
sudo apt-get install libreadline-dev
Then I uninstalled ruby
rvm remove 2.1.1
I installed ruby again
rvm install 2.1.1
I told RVM to use the default (2.1.1) Ruby
rvm use default
I reinstalled Rails and readline
gem install rails
gem install readline
I got an error again launching the console, but a slightly different one:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': /usr/local/lib/libreadline.so.6: undefined symbol: UP - /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so (LoadError)
from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
So following this instructions (http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/), I got it to work:
cd /usr/local/lib
mkdir temp
mv libreadline* temp
ldconfig
apt-get update
Thanks to hunterboerner for the help!
This worked out ok on a Solaris machine that had no readline, might work for you:
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):027:0> require 'console_app'
=> true
I had this problem a while back, solved by typing: rvm requirements and installing what came back. Seemed to, although this was an older version of rvm so may no longer be relevant
rvm reinstall 2.7.0
worked for me

cannot load such file -- script/../config/boot (LoadError) after OSX Mavericks

I was doing development on a ruby on a rails application (v2.3) yesterday and decided to update my iMac to OSX Mavericks. Now, every time I try to run my application locally, I get the following error. Does anyone know whats causing this?
Run like this:
script/server -e development
Error:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- script/../config/boot (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from script/server:2:in `<main>'
script/server (file)
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../config/boot'
require 'commands/server'
It was working fine before installing OSX Mavericks.
Things I Noticed:
the version of ruby installed in now 2.0 (it was v1.8.7 before)
FYI: I'm still fairly new to rails.
After Installing RVM:
Ok so I setup RVM and made sure the version of ruby (1.8.7) and rails (2.3.11) are installed and configured as the default.
Installed RVM:
curl -L https://get.rvm.io | bash -s stable --rails
Install Ruby 1.8.7:
rvm install ruby-1.8.7-p374
Set v1.8.7 as the default version:
rvm --default use 1.8.7
Install Rails v2.3.11:
gem install rails -v 2.3.11
Install all the gems from system
rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system
Now when I run my app, I get the following error: (what am I missing?)
=> Booting WEBrick...
/Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require': no such file to load -- haml (MissingSourceFile)
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/plugins/haml/init.rb:5:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:95:in `evaluate_init_rb'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:91:in `evaluate_init_rb'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin.rb:44:in `load'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:33:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:32:in `each'
from ./script/../config/../vendor/rails/railties/lib/rails/plugin/loader.rb:32:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:292:in `load_plugins'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:142:in `process'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:97:in `send'
from ./script/../config/../vendor/rails/railties/lib/initializer.rb:97:in `run'
from /Users/imaginationplus/gitlocal/dfc_workshop/config/environment.rb:14
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/railties/lib/commands/servers/webrick.rb:59
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `gem_original_require'
from /Users/imaginationplus/.rvm/rubies/ruby-1.8.7-p374/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:53:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require'
from /Users/imaginationplus/gitlocal/dfc_workshop/vendor/rails/railties/lib/commands/server.rb:39
from script/server:3:in `require'
from script/server:3
The main thing to understand from this issue is that you cannot rely on the OS for your ruby version or the gems that you are using within a ruby project. As you create additional ruby apps you may run into trouble with this again.
- To manage the gems use Bundler
Bundler maintains a consistent environment for each ruby applications.
- To manage the Ruby versions use rbenv or rvm
the version of ruby installed in now 2.0 (it was v1.8.7 before)
In 2.x version of Ruby, the current directory is no longer in $LOAD_PATH by default. That means that using require to load files relative to the current directory (such as script/../config/boot which expands to simply config/boot) won't work.
Alternatives are:
edit $LOAD_PATH to include the current directory by e.g. $LOAD_PATH << "."
use require_relative
Above solution was found here

Resources