I resorted to upgrading Ruby from 2.3.0 to 2.3.1 because of a really weird error I was getting and not being able to even come close to finding more info around google/SO.
Now after trying to figure this out I am getting this error whenever I try to run the project, or run bundle or rails in bash
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require': cannot load such file -- bundler (LoadError)
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.0/exe/bundle:10:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/bundle:23:in `load'
from /usr/local/rvm/gems/ruby-2.3.1/bin/bundle:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
I have already tried reinstalling Ruby, RVM, bundler, but the error persists. I cannot find much info on that specific error around the web so I hope someone can help me troubleshoot this through here. Let me know if there are any specific logs I can provide and I will happily add more info.
EDIT:
I just noticed the path is ...ruby-2.3.1/lib/ruby/ 2.3.0 ... (the difference of 2.3.1 and 2.3.0)
When I upgraded to 2.3.1 I uninstalled previous versions. Could that be an issue since the error comes from a path that refers to a non-existing version of ruby?
Not sure why all this happened and what was wrong with the bundler, but what ended up fixing it for me was this command:
gem update --system
Related
Once I upgraded to Big Sur, I immediately got the following error in Ruby on Rails when launching the server:
$ rails s
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/x86_64-darwin19/stringio.bundle: warning: already initialized constant StringIO::VERSION
You've tried to invoke Spring when it's already loaded (i.e. the Spring constant is defined).
This is probably because you generated binstubs with Spring 1.0, and you now have a Spring version > 1.0 on your system. To solve this, upgrade your bundle to the latest Spring version and then run `bundle exec spring binstub --all` to regenerate your binstubs. This is a one-time step necessary to upgrade from 1.0 to 1.1.
Here's the backtrace:
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/bootsnap 1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `block in load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/Users/carsoncole/.rvm/gems/ruby-2.7.1/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<main>'
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/carsoncole/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/carsoncole/scout_activity/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
I followed the directions given above but to no avail. Any thoughts?
If I create a new Rails app, the server starts up fine. Using Rails 6.0.3.4 and Ruby 2.7.3
One difference between the new app and my existing app is the new app did not use 'pg'. When I added 'pg' (pg-1.2.3) to the new app, the same error occurs.
[UPDATE] I think the issue may be related to Homebrew. I'm now reinstalling.
I found a solution, although I can’t pinpoint exactly why it worked.
I reinstalled Homebrew, and Posgresql (with HB). I also updated Xcode and the command line libraries. In the process of reinstalling homebrew and Xcode, I believe a number of libraries were updated/installed which I suspect was the issue.
Works fine now.
I have ruby on rails installed and something kinda went fubar on it. When I try to generate a controller, I get the following:
➜ librius rails generate controller Teachers
Running via Spring preloader in process 27015
/Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load': no implicit conversion of nil into String (TypeError)
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `block in load'
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_dependency'
from /Users/erick/.rvm/gems/ruby-2.4.0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:287:in `load'
from /Users/erick/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/erick/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
➜ librius
I've tried to uninstall/reinstall using gem and RVM but nothing seems to work.
Thanks.
The comments helped point in the right direction.
I did a gem upgrade (which I had to download because it kept telling me I had the latest). Then I did gem pristine --all, then spring stop. (Still wasn't working.) Then lastly, bundle install and voila! Such a hassle! Thanks!
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
I work on windows, have rails 3.2.12(just upgraded) and ruby 2.0.0p0. when i try to delete a controller i get this error:
F:\my apps\meshworks-redo> rails d controller Plans
C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/pg-0.14.1-x86-mingw32/lib/pg.rb:10:in `require': cannot load such file -- 2.0/pg_ext (LoadError)
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/pg-0.14.1-x86-mingw32/lib/pg.rb:10:in `rescue in <top (required)>'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/pg-0.14.1-x86-mingw32/lib/pg.rb:3:in `<top (required)>'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:72:in `require'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:70:in `each'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:70:in `block in require'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:59:in `each'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler/runtime.rb:59:in `require'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/bundler-1.3.2/lib/bundler.rb:132:in `require'
from F:/my apps/meshworks-redo/config/application.rb:7:in `<top (required)>'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:24:in `require'
from C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/railties-3.2.12/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I tried re installing the pg gem, no luck.
A friend of mine got the same problem when using Ruby 2.0 on Windows 7 with Postgres. It occurs not only when trying to destroy a controller, but for every database action (including rake db:create). The problem is that the pg_ext.so file is not included for ruby 2.0. It is included for 1.9, but simply copying this to the 2.0 does not seem work. However, I found another method to obtain the correct pg_ext.so. Not exactly sure why this works, but it works for him. Here is what you need to do:
Go to the folder where 2.0/pg_ext.so (the file that could not be found) should be located. In your case C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/pg-0.14.1-x86-mingw32/lib/.
Create a folder called '2.0' (without the quotes) here.
In this folder you will need the correct pg_ext.so file. You can obtain this in the following way:
Manually install the pg gem ("gem install pg" in console). This installs the non x86-mingw32 version of the gem. It does not fix the problem, but it does create the correct pg_ext.so. I think this is because it compiles the pg gem for your system, so for ruby 2.0. You can then use this pg_ext.so file with the pg x86-mingw32 version. You will need DevKit in order to compile and install pg (http://rubyinstaller.org/add-ons/devkit/).
Go to the location of pg_ext.so in the pg-0.14.1 gem folder. In your case this would be C:/Users/rrw/.pik/rubies/Ruby-200-p0/lib/ruby/gems/2.0.0/gems/pg-0.14.1/lib.
Copy the file pg_ext.so from this folder to the newly pg-0.14.1-x86-mingw32/lib/2.0/ folder in step 2.
Now retry your commands and check if everything works. If it does not, delete your Gemfile.lock and re-run bundle install.
The same problem with this gem might occur with other mingw32 gems as well. IFor example, I had the same problem with the bcrypt-rails gem. Following the same steps as described above fixed the problem. I am now successfully running Ruby 2.0 on Windows 7.
Ps. If you have any other problems running the pg gem on Windows 7 64 bit, then try to install the 32 bit x86 version of Ruby (the RubyInstaller) and postgresql. Furthermore, make sure you include the Ruby folders in your path (this is an option while installing ruby 2.0 using the RubyInstaller) as well as the Postgresql lib and bin folders.
Good luck!
I created a fresh project using rails new Project -d=postgresql. If I then run rails server, I get the following error message:
C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `require': cannot load such file -- active_model (LoadError)
from C:/GemRepository/gems/actionpack-3.1.3/lib/action_dispatch.rb:34:in `<top (required)>'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `require'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands/server.rb:3:in `<top (required)>'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `require'
from C:/GemRepository/gems/railties-3.1.3/lib/rails/commands.rb:48:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I also tried
gem which active_model
which returned
C:/GemRepository/gems/activemodel-3.1.1/lib/active_model.rb
Please help me.
Had this problem, came across this post. This fixed it for me:
rvm gemset pristine
Well, I managed to solve it.
I restarted my computer, deleted everything from my gem repository, reinstalled rubygems (ruby setup.rb) and reinstalled rails (gem install rails).
Thanks anyway :)
What version of rails is in the gem file? And have you run 'bundle install'?
I notice that Actionpack is 3.1.3 is called by the server, but the activemodel found is 3.1.1.
Run the bundle command from the project directory
I had a similar error and it was due to accidentally corrupting my Gemfile, so it is worth checking that. If it is version controlled then just git checkout Gemfile and bundle update to rebuild.
gem uninstall active-model and perfomr gem install active-model