Error while pushing the gem to rubygems.org (NameError) - ruby

I've build a gem and try to push it to rubygems.org.
When executing gem push gem_name-1.0.0.gem I get this error after I've entered my credentials:
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::ConfigFile::FileUtils
Dit you mean? FileTest
But I don't use FileUtils in my Ruby application. What am I doing wrong? Any ideas?

Your version of gem seems to be affected by the issue described here on GitHub. The maintainer answered in the thread on GitHub that the bug was fixed in the meantime.
Therefore, I suggest updating your local version of gem with the following command:
gem update --system

Related

Rails asset precompile aborted on Heroku Push - uninitialized constant Rake::DSL

I've seen this error from a couple years ago when Rake would break Rails, but this seems strange.
I deployed my Rails 3.2.16 app to Heroku just yesterday, but now precompiling assets fails with no changes to any assets. Full error below:
Running: rake assets:precompile
rake aborted!
uninitialized constant Rake::DSL
/tmp/build_96e5edbe-65ff-42fc-a7e8-e59432cc8de0/Rakefile:7:in `<top (required)>'
Curious if there were recent breaking changes or what I'm missing that would all of a sudden change things.
Rake is version 10.1.0. Ruby version 1.9.3 locally and 1.9.2 on Heroku.
Saw this: https://groups.google.com/forum/#!topic/heroku/6yjIiP69NqI (from ~2 years ago), which suggested instead of just include Rake::DSL to use
class Rails::Application
include Rake::DSL
end
Still, no idea why that would change overnight.
I had the same problem just now. I updated it the ruby version to 2.0.0 in the Gemfile (it was 1.9.2) and it deployed successfully after that.
To update the version simply add this under the source line in your Gemfile:
ruby "2.0.0"
I hope this solves your issues as well.
Same issue as the rest of you, just out of the blue went to update the application and push to heroku resulting in this error. If I find anything as I play around will update here.
Huzzah, I was successful running 'git push heroku master' after reinstalling rake and updating the Rakefile for DSL support.
Reinstall Rake:
gem uninstall rake
*I selected to uninstall all versions
gem install rake
Update Bundler:
bundle update
Update Rakefile, adding the require:
require 'rake/dsl_definition'
And Update Rakefile, adding the module:
module ::ApplicationName
class Application
include Rake::DSL
end
end
*Make sure to update ApplicationName to your app name.
Committed to git and ran an update:
git push heroku master
Hope that helps get you guys back up and running, not sure what happened with Heroku but if this corrects your issue #muzcat007 maybe you could update your Heroku ticket to have them look into this odd new DSL requirement.
Cheers

toy/doc undefined method 'available?'

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

"Could not find a valid gem in any repository" (rubygame and others)

I've been trying to install this 'rubygame' gem for some time, but whenever I use the command
gem install rubygame
it will give an error:
ERROR: Could not find a valid gem 'rubygame' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
I've also tried other gems but with similar results:
ERROR: Could not find a valid gem 'rake' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: Connection timed out - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
I've already made sure I have an internet connection, and have already tried reinstalling both ruby and rubygems (currently using ruby 1.8, rubygems 1.7.2). Googling didn't help me at all. I would be very grateful if anyone can solve my problem. My sources list only shows http://rubygems.org
Check if you have "https://rubygems.org/" as a source to find gems at:
$ gem sources
*** CURRENT SOURCES ***
https://rubygems.org/
If not, you should be able to add it with
$ gem sources --add https://rubygems.org/
https://rubygems.org/ added to sources
Here are docs for the gem source command.
You can also add the source you want on the command whenever you have troubles using https, like this:
gem install GEMNAME --source http://rubygems.org
It's better to fix the SSL problem though.
are you behind any proxy?
check your browser for proxy that you might use:
execute the command: gem install xxx --http-proxy=http://user:password#server and you should be good to go.
You don't have an Internet connection to rubygems.org.
This happens sometimes if the site is down or blocked.
This command can show you if your connection has a way to reach rubygems.org:
traceroute rubygems.org
Maybe you should try
gem list -r
then
gem install -r rubygame
Also note that with rvmon MacosX (Lion in my case) you should install ruby-1.9.3-p194 (for Xcode 4.x compiler considerations) then
rvm rubygems current
and in my case I had to use
rvm use ruby-1.9.3-p194#global
(which contains bundler, rake, rubygems-bundlerand rvm)
and not
rvm use ruby-1.9.3-p194
(which is empty)
Can you post your versions?
ruby -v
#=> ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
gem -v
#=> 1.8.19
If your gem command is not current, you can update it like this:
gem update --system
To see if you can connect to rubygems.org using Ruby:
require 'net/http'
require 'uri'
puts Net::HTTP.get URI.parse('https://rubygems.org')
If yes, that's good.
If no, then somehow Ruby is blocked from opening a net connection. Try these and see if any of them work:
curl https://rubygems.org
curl https://rubygems.org --local-port 1080
curl https://rubygems.org --local-port 8080
env | grep -i proxy
If you're using a company machine, or within a company firewall, or running your own firewall, you may need to use a proxy.
For info on Ruby and proxies see
http://www.linux-support.com/cms/http-proxies-and-ruby/
I have fixed this issue using the proxy command option of gem install. It has the following format:
$ gem install --http-proxy http://201.187.107.19:8080 rubygame
Note, the IP address and the port number refers to a proxy. You should search for a proxy list and use one of the proxies there.
This is site with proxies: http://www.cybersyndrome.net/pla5.html
Also, I have to try 7 or 8 different proxies in order to succeed. Do not give up.
Use :
gem sources --add http://rubygems.org/
Do you want to add this insecure source? [yn] [YES]
then use
gem install sass
and done
I know this is a little late, but I was also having this issue a while ago. This is what worked for me:
REALLY_GEM_UPDATE_SYSTEM=1
sudo gem update --system
sudo gem install rails
Hope this helps anyone else having this issue :)
I have tried most of the solutions suggested here but I had no luck.
I found a solution that worked for me, which was manually updating the gemfile to 2.6.7.
The guide on how to do is in guides.rubygems.org: installing-using-update-packages
Download rubygems-update-2.6.7.gem to your C:\
Now, using your Command Prompt:
C:\>gem install --local C:\rubygems-update-2.6.7.gem
C:\>update_rubygems --no-ri --no-rdoc
After this, gem --version should report the new update version (2.6.7).
You can now safely uninstall rubygems-update gem:
C:\>gem uninstall rubygems-update -x
Removing update_rubygems
Successfully uninstalled rubygems-update-2.6.7
The reason why this did not work before was because server used certificates SHA-1, now this was updated to SHA-2.
For what it is worth I came to this page because I had the same problem. I never got anywhere except some IMAP stuff that I don't understand. Then I remembered I had uninstalled privoxy on my ubuntu (because of some weird runtime error that mentioned 127.0.0.1:8118 when I used Daniel Kehoe's Rails template, https://github.com/RailsApps/rails3-application-templates [never discovered what it was]) and I hadn't changed my terminal to the state of no system wide proxy, under network proxy.
I know this may not be on-point but if I wound up here maybe other privoxy users can benefit too.
check your DNS settings ...I was facing similar problem ... when I checked my /etc/resolve.config file ,the name server was missing ... after adding it the problem gets resolved
This worked for me to bypass the proxy definitions:
1) become root
2) gem install -u gem_name gem_name
Hope you can work it out
I tried to install a gem which is for JRuby only, running into the same error. Using jruby's command worked then:
jruby -S gem install some_jruby_gem
If you are running behind the any firewall(if firewall blocking gem installation). just try following command it works.
gem install --http-proxy http://username:pwd#server:port gem
Make sure you type the command from the "App" Directory
It is a permission issue.
try with sudo

Sinatra Gem install error

I have been trying to install sinatra in a macbook running leopard system, and I am not able to do it.
I get the following error.
MacBook:rubygems-1.3.7 lakshmanan$ gem install sinatra
WARNING: RubyGems 1.2+ index not found for:
http://rubygems.org/
RubyGems will revert to legacy indexes degrading performance.
Bulk updating Gem source index for: http://rubygems.org/
ERROR: While executing gem ... (NoMethodError)
undefined method `gems' for #<Array:0x101901008>
Please help. I reinstalled gems also. Still I get the same error.
rubygems.org does not seem to be responding right now. Try again later. It's probably nothing on your end.

Installing rake

we tried to install rake on our pc but there were following errors.. We even tried updating gems but in vain. We need to run some tasks on rake and dont know how to go abt it.
C:\Documents and Settings\nemanich\My Documents\gems>gem install rake-compi 0
.7.0.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: Error installing rake-compiler-0.7.0.gem:
rake-compiler requires RubyGems version >= 1.3.5
C:\Documents and Settings\nemanich\My Documents\gems>gem install update_rubygems
.gem
ERROR: http://gems.rubyforge.org/ does not appear to be a repository
ERROR: could not find gem update_rubygems.gem locally or in a repository
Are you behind a proxy server? If so, set your HTTP_PROXY environment variable appropriately. This is the sort of error you get when the repository can't be contacted. For example:
set HTTP_PROXY=http://proxy.mycompany.com:8888
will set it temporarily.
I don't think that's the command to update RubyGems. Have you tried gem update --system? You might be able to install Rake after that.

Resources