When I attempt to run sudo update_rubygems or sudo gem update --system I get similar errors:
Installing RubyGems 3.2.3
Traceback (most recent call last):
4: from setup.rb:23:in `<main>'
3: from setup.rb:23:in `require'
2: from /var/lib/gems/2.5.0/gems/rubygems-update-3.2.3/lib/rubygems.rb:1348:in `<top (required)>'
1: from /var/lib/gems/2.5.0/gems/rubygems-update-3.2.3/lib/rubygems.rb:1348:in `require'
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:43:in `<top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
I've tried reinstalling RubyGems 3.2.3 from source using ruby setup.rb and I get essentially the same error.
Traceback (most recent call last):
4: from setup.rb:23:in `<main>'
3: from setup.rb:23:in `require'
2: from /home/izaguirrejoe/Downloads/rubygems-3.2.3/lib/rubygems.rb:1348:in `<top (required)>'
1: from /home/izaguirrejoe/Downloads/rubygems-3.2.3/lib/rubygems.rb:1348:in `require'
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:43:in `<top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
One clue: I'm a noob and I ran sudo apt-get autoremove and it removed a bunch of Ruby-looking stuff. Maybe that was it? I did that, updated Vim to the newest version and installed YouCompleteMe, and now my existing rails app is not working. New rails apps work just fine, but I'd like to be able to update RubyGems. I'm on the verge of just reinstalling Debian and starting over, this is frustrating.
Another clue: hours of research has revealed that I may have two versions of Ruby installed. When I run which -a ruby I get
/usr/bin/ruby
/bin/ruby
Related
I encountered some errors with my redmine installation.
I tried to update ruby and gems, but I'm not finding out a solution.
When I start the server, I got this answer :
:/usr/share/redmine# rails server
You must use Bundler 2 or greater with this lockfile.
So I tried to update it but I'm still stuck with it :
gem update --system
Installing RubyGems 3.2.16
/usr/lib/ruby/vendor_ruby/rubygems/defaults/operating_system.rb:43:in `<top (required)>': uninitialized constant Gem::BasicSpecification (NameError)
from /var/lib/gems/2.3.0/gems/rubygems-update-3.2.16/lib/rubygems.rb:1348:in `require'
from /var/lib/gems/2.3.0/gems/rubygems-update-3.2.16/lib/rubygems.rb:1348:in `<top (required)>'
from setup.rb:23:in `require'
from setup.rb:23:in `<main>'
Has anyone an idea ?
yes, but same at the end.
I finally "solved" the trouble by updating everything (redmine, debian 9->10 etc...)
Not a real solution but it works fine now...
I am trying to get Ruby on Rails working on my laptop and haven't been able to. At some point I took some bad advice and used sudo and have been trying to undo that error and the corresponding issues since.
As of right now, ruby -v shows
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
So, I think Ruby is installed. When I try to run gem install rails or any other gem command like gem install bundler, I get this error
Error loading RubyGems plugin "/Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/executable-hooks-1.6.0/lib/rubygems_plugin.rb": cannot load such file -- executable-hooks/wrapper (LoadError)
Error loading RubyGems plugin "/Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/gem-wrappers-1.4.0/lib/rubygems_plugin.rb": cannot load such file -- gem-wrappers (LoadError)
/Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Traceback (most recent call last):
20: from /Users/audreybrooke/.rbenv/versions/2.7.1/bin/gem:21:in `<main>'
19: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:44:in `run'
18: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `do_configuration'
17: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/gem_runner.rb:79:in `new'
16: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/config_file.rb:182:in `initialize'
15: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/config_file.rb:332:in `load_file'
14: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems.rb:710:in `load_yaml'
13: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
12: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
11: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/yaml.rb:4:in `<top (required)>'
10: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
9: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
8: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych.rb:15:in `<top (required)>'
7: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
6: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
5: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/nodes.rb:2:in `<top (required)>'
4: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
3: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
2: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/psych/nodes/node.rb:2:in `<top (required)>'
1: from /Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Users/audreybrooke/.rbenv/versions/2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': incompatible library version - /Users/audreybrooke/.rvm/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0/gems/stringio-0.1.0/lib/stringio.bundle (LoadError)
It's because you have not installed libyaml correctly. Since you are using MacOS, maybe install it using homebrew can solve the problem.
brew install libyaml && brew link libyaml
I recommending to use rvm. It handle these like of dependency problems under the hood.
I did
sudo rm -rf ~/.rvm
because I had rvm and rbenv installed and that worked
Unable to run rails console, rails -v etc. Already tried all of the solutions, reinstalled ruby, installed bundler but neither worked for me.
Traceback (most recent call last):
4: from bin/rails:3:in `<main>'
3: from bin/rails:3:in `load'
2: from /var/www/App/releases/XXXXXXXXXXX/bin/spring:8:in `<top (required)>'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler (LoadError)
A few days back I also land up into the same issue, I think it was due to spring caching some gems and configurations. I fixed it by running bundle pristine.
This restores installed gems based on the Gemfile.lock to pristine condition from files located in the gem cache.
I don't know if it's related but I'd like to inform I use ASDF (https://github.com/asdf-vm/asdf) to versioning my PLs.
My problem is: I can't access rails commands on VSC terminal.
I get:
$ rails -v
Traceback (most recent call last):
4: from bin/rails:3:in `<main>'
3: from bin/rails:3:in `require_relative'
2: from /home/italo/Área de Trabalho/code-saga/3/cookbook_parte1/config/boot.rb:3:in `<top (required)>'
1: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
This doens't happen when I do 'ruby -v'.
I'm using ubuntu 18.04 and when I run both commands (rails -v, ruby -v) in ubuntu terminal, everything works fine.
I installed the ruby plugin in vsc and restarted the terminal. Worked!
i already try a lot o diferent way but cant solve this problem
.it seems that i cant install gems but i cant figure out why
already try with gem install bundler but steel doestn work
taller_integracion git:(develop) bundle install
Traceback (most recent call last):
7: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
6: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
5: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `<main>'
4: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/bundle:23:in `load'
3: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/bin/bundle:13:in `<top (required)>'
2: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor.rb:124:in `start'
1: from /Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor/base.rb:377:in `start'
/Users/seba/.rvm/gems/ruby-2.5.3/gems/bundler-0.9.26/lib/bundler/vendor/thor/shell.rb:10:in `shell': uninitialized constant Thor::Base::Config (NameError)
and if i try with:
taller_integracion git:(develop) bundler install
Traceback (most recent call last):
10: from /Users/seba/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:10:in `<main>'
9: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `run'
8: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:49:in `each'
7: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/executable-hooks-1.6.0/lib/executable-hooks/hooks.rb:50:in `block in run'
6: from /Users/seba/.rvm/gems/ruby-2.5.3#global/gems/rubygems-bundler-1.4.5/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>'
5: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
4: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
3: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require'
2: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:131:in `<top (required)>'
1: from /Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:124:in `check'
/Users/seba/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/rubygems-bundler-1.4.5/lib/rubygems-bundler/noexec.rb:84:in `setup': undefined method `rubygems' for Bundler:Module (NoMethodError)
I faced this problem. I was working on a small project hence I just updated ruby version in gemfile to 2.6.3 and it worked for me.
create a new gemset with this ruby version and then run
gem install bundler
to install bundler with the latest ruby.
Now run
bundle install
if bundle install does not work then try
bundle update
this should do the trick.
If you are still facing the same issue then let me know.