When using eval_gemfile in Gemfile Bundler works. But gem install -g fails with
ERROR: While executing gem ... (NoMethodError)
undefined method `eval_gemfile' for #<Gem::RequestSet::GemDependencyAPI:0x000000000268a388>
Using eval File.read(...) works but I'm worried about any implications that I need to watch for.
It seems like the only reason to use eval_gemfile is readability and nicer syntax error reporting:
https://github.com/rubygems/bundler/commit/c6100f6bd246a8259f159285967f075b592e80c9
wrt the #untaint call, it appears to be some remains of 1.8.7 test suite requirements. I tested it working without #untaint on 2.5.5 so I wouldn't bother to add this call:
https://github.com/rubygems/bundler/pull/4770#discussion-diff-71091844
Related
My RubyGems isn't working, throwing an error which goes as follows, triggering (nearly) on any Gem task:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:1081:in `<top (required)>': uninitialized constant Gem::GEM_PRELUDE_SUCKAGE (NameError)
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
I'm new to Ruby / RubyGems / installing Ruby and all I know is that an uninitialized constant is essentially a undefined variable. It could also be possible that it's something with Ruby itself, although the ->Gem:GEM<-_PRELUDE_SUCKAGE points me to RubyGems.
In a nutshell, I installed a bunch of Ruby things (think RVM, rbenv, etc.) to develop Ruby on Rails, as I thought it would be a good way to learn Ruby.
Well, after going through a long and tedious process to upgrade Ruby to 2.6.3, then downgrade to 2.5.5 and then 2.4.0, then back up to 2.5.5 and solving downgrade issues, RubyGems throws the error. I settled on 2.5.5 because 2.6.3 caused errors and 2.4.0 was too early of a version.
It's causing all sorts of errors, like HAML not compiling and Rails not making a controller. I really don't know what's happening.
If I run gem install [gem name], it throws the error. Running rails generate controller [name] index (for those not familiar to Rails this creates, well, a controller) it throws the error. Doing anything really with the gem command causes the error, except for gem server.
If I upgrade back up to the latest Ruby version, I fear that my gem command will go all wonky again and I'll have to go through another day of troubleshooting versions. How do I fix this, or at least get rid of the message so I can create things again?
I had this happen to me just today. It seems, somehow, my ruby version had been corrupted. When I ran rvm list version 2.5.1 was listed as 'broken'. I had to uninstall 2.5.1 fully (using sudo even in my case) to get to a clean slate.
Then, when attempting to reinstall, rvm was giving me all kinds of grief after a new gpg key which I initialy couldn't get to install properly (hint).
After a clean wipe of ruby 2.5.1, updating rvm to latest version and reinstalling, I got this error: Error running 'env GEM_HOME=/ruby-2.5.1#global GEM_PATH= /Users/user/.rvm/rubies/ruby-2.5.1/bin/ruby -d /Users/user/.rvm/src/rubygems-3.0.8/setup.rb --no-document',.
It appears that an update to MacOSX deprecated a version of OpenSSL which causes some issues. I ended up following this thread and ran rvm gemset create global --default and then bundle install to get passed the Gem errors.
Honestly, rails is supposed to be easier than this. I wish docker was easier to reason about sometimes. These are the kinds of issues docker supposedly promises to fix eh?
Meaning, with capistrano I want to install ruby (and rvm), some gems by means of bundler, and perform some tasks using them. Is this even possible? When I try to install gems with rvm1-capistrano3 gem, it fails with this:
Installing light_resizer (0.2.0)
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
If I make use of capistrano-bundler alongside above mentioned gem, setting bundle_bins to [] (to be able to install bundler), I can't run tasks like deploy:assets:precompile later on.
What I did is use capistrano-bundler after all, but set :bundle_bins, [:rake], as rake is all I needed. Not a perfect solution, probably, but when was it the last time it was perfect... :)
I'm working with pry 0.10.1 java and pry-nav 0.2.4 on jruby 1.7.12 (1.9.3p392). In the middle of an rspec step after invoking binding.pry, I type the pry command:
whereami
All I get is
ArgumentError: Symbol or String expected, but NilClass given.
from /Users/yc98js1/.rbenv/versions/jruby-1.7.18/lib/ruby/gems/shared/gems/coderay-1.1.0/lib/coderay/helpers/plugin.rb:215:in `validate_id'
whereamI going wrong? [pun intended]
Seems like the error was thrown by the coderay gem. Could be a collision of this gem with another.
It might be unrelated but its hiding the error. try uninstalling coderay first and running the code again.
I'm attempting to build local Ruby documentation as suggested here:
https://github.com/toy/doc
However when I use the default Rakefile I get the following:
[Documentation]$ rake build
configuring and updating: 100.0%
rake aborted!
undefined method `available?' for Gem:Module
/Users/snowcrash/.rvm/gems/ruby-2.0.0-p195/gems/sdoc-0.2.20/lib/sdoc/json_backend.rb:9:in `<top (required)>'
Any suggestions?
I don't know much about ruby (and even less about the gem ecosystem built up around it), but I believe a possible workaround for this issue is to find what gems the project requires and manually install them. In the case of this particular project, it looks like you need the gem "fspath".
At the project root, type
gem install fspath
and try re-running rake.
I honestly don't know the actual root cause of the issue, other than that presumably, your version of the 'gem' program is probably > v2, while some other program (rake?) expects it to be older and still support the "available?" method.
If installing "fspath" doesn't fix the issue, you could try downgrading your version of gem by doing
gem install -v [some version of gem older than v2]
Check gem install --help for more info on this.
This is just for future visitor who has the same issue.
As ekremkaraca said, you can just solve this by downgrading rubygems.
rvm install --force rubygems 1.4.2
I'm trying to start a rails application in IntelliJ with the Ruby plugin.
I've imported the application and set up the run configuration as best I can. When I try to run it I get the error:
NoMethodError: undefined method `version_requirements' for #<Gem::Dependency:0x7de21f45>
When looking for an answer I found this page saying that I should do this:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Since it's IntelliJ's ruby plugin that is managing the gems, I assume that I have to change the version of rubygems-update that the plugin is using.
Is this the right approach to take? And if so, can anyone tell me how to go about it?
I tried listing the gems but that gem is not shows so I must not be listing the gems in the right place, but I don't know where to look.
Many thanks :)
IntelliJ IDEA cannot handle it, you will need to install the appropriate rubygems version from the command line.
Note that your current rubygems-update version may be different, verify it with gem list and use the reported version when uninstalling.