Gem not installing, showing connection error - ruby-on-rails

When I try to install gem like bundler or rake after creating new gemset , its not installing
,but if i intall old version its working fine for me . Here are the error logs while installing gems
gem install rake
Fetching: rake-0.9.2.2.gem ( 7%)ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
too many connection resets (http://cachefly.mirrors.rubygems.org/gems/rake-0.9.2.2.gem)

This problem was caused by the cachefly server.
It seems that the folks over at rubygems.org disabled this mirror and then people's downloads were able to continue successfully.
There is a thread over at rubygems.org discussing this issue.

Use DevKit to install gem separately .
Edit :
Please check if you curl or wget that URL:
wget http://production.cf.rubygems.org/gems/rails-2.3.8.gem
curl -O http://production.cf.rubygems.org/gems/rails-2.3.8.gem
If not, then the problem is with your internet connection, http proxy or
provider.
If your browser works, might be due an HTTP proxy.

I had a similar issue when Capistrano was running a bundle install on a remote server. It seems to have been caused by a .rvmrc file in the project that I had not authorised.
So all I had to do to fix is was ssh into the server, cd into the project and accept the .rvmrc config file.

got similar problem
gem install rails
# after 5 minutes
WARNING: Error fetching data: too many connection resets (http://production.s3.rubygems.org/latest_specs.4.8.gz)
gem install rails --source 'https://rubygems.org'
# after 5 minutes
WARNING: Error fetching data: too many connection resets (http://production.s3.rubygems.org/latest_specs.4.8.gz)
but when I create Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.13'
and run bundle install it works
my location is London, UK
(also created topic on http://help.rubygems.org/discussions/problems/4494-too-many-connection-resets-when-gem-install-rails )

Always check if your computer isn't downloading because of administrator privileges (in cmd, shell, or rubymine).

Related

Capistrano SSH::AuthenticationFailed, not prompting for password

I've been using capistrano successfully for a while now and all of a sudden in every project I've lost the ability to deploy.
Environment:
os X (Mavericks)
ruby 1.9.3p194
rvm (locally, not on server)
rails 3.2 and up
RubyGems 1.8.25
I'm not using rsa_keys or anything I want capistrano to prompt for user and password. Suddenly it has decided not to ask for a password, but does ask for user. Then it rolls back and gives me the following error.
[deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: sub.example.com (Net::SSH::AuthenticationFailed: Authentication failed for user user#sub.example.com)
connection failed for: sub.example.com (Net::SSH::AuthenticationFailed: Authentication failed for user user#sub.example.com)
This has occurred on my personal laptop and my iMac at work. It occurs when deploying to two different servers (both linux)
I'm completely at a loss here. Any ideas?
Figured it out! Apparently this issue was with net-ssh gem. I had version 2.8.0 installed recently with some updates to my development environment and was the cause.
I'm not sure why it was failing, but gem uninstall net-ssh -v 2.8.0< fixed it for me.
If anyone actually knows why this was an issue or how I can correct this issue with the newer version of net-ssh I'd be interested to hear it.
The answer may break your rails app due to gem dependancies.
The issue is with net-ssh as was correctly answered by Sparkmasterflex, however whilst this will get capistrano working ok it may break your rails app:
These steps fixed both capistrano and rails for me ...
In your Gemfile add gem 'net-ssh', '2.7.0'
Run bundle update net-ssh
Run bundle (just to be sure everything is working ok'
Run gem uninstall net-ssh -v 2.8.0
If you are a rails user you should now be able to run both the rails server and capistrano.
I have a workaround that doesn't require downgrading net-ssh, per a comment at the link that Zach Lipton posted. Place this code in config/deploy.rb:
set :ssh_options, {
config: false
#Other options...
}
After I did that, I got another error, Error reading response length from authentication socket. Found the solution to that here. Execute these commands at your Bash prompt:
$ eval $(ssh-agent)
$ ssh-add
Upgrading your net-ssh version to 2.8.1 will solve the problem. They released a version bump in 19th february 2014 that fix this and other problems.
Uninstall your current net-ssh gem (gem install net-ssh -v 'version')
Just paste this on your Gemfile:
gem 'net-ssh', '~> 2.8.1', :git => "https://github.com/net-ssh/net-ssh"
Run bundle install
I had the same problem while deploying using capistrano
Net::SSH::AuthenticationFailed: Authentication failed for user deployer#IP
ssh-copy-id deployer#ip
This will add your keys to server and you can login without password.
set :ssh_options, {
verbose: :debug
}
... helps a lot!
I had an issue that I generated my public and private keys with puttygen and exported private key as OpenSSH with name <somename>.id_rsa. An then saved public key with name <somename>.id_rsa.pub.
( ! ) The public key puttygen saves is in RFC 4716 format not PEM. Use public suffix instead of pub for public key file-
This snippet works for me:
group :development do
#.....
gem 'capistrano', "~> 2.15"
gem "net-ssh", "~> 2.7.0"
#.....
end
First try to connect to your server with certificate (file.pem) with this command:
ssh -i "file.pem" user#yourServerIp
Then try to run cap production deploy. It solved error for me. I think it is because time limit for certificate expired.
If all the above solutions doesn't work,please restart your system as you might be facing the issue due to net-ssh host connections.when you restart and enter the deployment command ,it will ask to add the identity to known hosts.

Could not verify the SSL certificate for http://gemcutter.org

I'm trying to make a bundle install and a rails server with an app I just received.
I don't understand, all the gem sources are http:// however i get a SSL error.
Screenshot of the error message
In my Gemfile there are no source starting with https://
What I've already tried :
remove Gemfile.lock
--trust-policy=NoSecurity
gem install rake -v '10.0.3' (command failed)
Thanks and sorry for my english
PS: I must run it on Windows
As per this and this thread gemcutter.org should redirect to rubygems.org. Just remove it from the sources and you should be fine.

Bundle Install could not fetch specs from https://rubygems.org/

I'm attempting to follow the Hartl Rails Tutorial, and having trouble with the bundler gem.
When using the commands 'bundle install' or 'bundle update' I get the following output:
Fetching source index from https://rubygems.org/
Could not fetch specs from https://rubygems.org/
I've searched for this output, but did not find many related issues online.
Maybe I have another gem that is interrupting bundler? I have little experience with rails at this point.
source 'https://rubygems.org'
gem 'rails', '3.2.12'
group :development do
gem 'sqlite3', '1.3.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
The solution for me was two parts: I changed https to http, and that temporarily solved the issue. The second issue was that I think I had a bad install of ruby 2.0.0 even though I was using a fresh install of ruby 1.9.3. So I reinstalled ruby 2.0.0, and I could use bundle install with https.
Just in case none of the above satisfies the next intrepid explorer, I thought I'd drop here that after I spent 4 hours on this doing variants of the search that landed me here, I finally discovering that IPV6 was the culprit, after finding this specific thread on help.rubygems.org. Solution? this (Fedora, Linux):
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
set up a shell script to flip IPV6 on and off so I could run a command without it, and now everything runs peachy.
I had the same issue. The only working solution I found was to force http instead of https in Gemfile:
source 'http://rubygems.org'
you can try the following, if in windows:
set HTTP_PROXY= <your proxy address without http://>
set HTTPS_PROXY=%HTTP_PROXY%
For eg:
HTTP_PROXY=mycompany.myproxy.com:8080
HTTPS_PROXY=%HTTP_PROXY%
Worked for me
It can be temporary network issue as well.
Try restarting network services using command
service network restart
If its *nix machine.
I had the same issue using ruby-2.0.0-p247 on OS X 10.8.5.
Make sure the first line in Gemfile is using https://
source 'https://rubygems.org'
I reinstalled that version of ruby.
rvm reinstall ruby-2.0.0
Ruby was upgraded ruby-2.0.0-p598 (version depends on latest patch).
bundle then worked without error although all the gems were reinstalled.
Mine was just a simple network issue, just restart pc / router
The other reason causing such that issues is the fact if you are behind proxy server. I describe here solution, maybe it will be usefull for someone else. :)
In case that you did not know Login/pass for yours proxy, and meet this issues you could firstly check if you need to (re)install anything, by command:
C:\...> bundle check
Resolving dependencies...
The Gemfile's dependencies are satisfied
If you get other respons then above, you could find properly gems in properly versions here (rubygems.org), then install it (from the directory with downloaded gem) by command:
gem install <gem-name> --locally
Use wget to see if you can reach the domain
wget http://rubygems.org/latest_specs.4.8.gz
If this fails then try the following.
Edit your /etc/resolv.conf file and add these lines near the top to use Google's name servers
nameserver 8.8.8.8
nameserver 8.8.4.4
I had this issue while working in Cloud 9. After trying several 'bundle install' and sending an email to c9 support(no reply) I was able to get it working by killing all the processes and doing a hard-restart of the IDE.
Do this by clicking directly on the little bar-graphs at the top of the right-hand side that show CPU, Memory, Disk. Then click on the process list, select them all, and force kill. Then exit out of the process list. Click on the bar-graphs again, and this time click 'Restart'.
After this I was able to run bundle with no problems.
Either with http or https did not work.
After I disabled the IP
v6, it worked
https://support.purevpn.com/how-to-disable-ipv6-linuxubuntu
Adding variable for proxy worked fine.
Additionally if you are using Bitnami redmine like me you can add that into setenv.bat then when you start command line with Bitnami Redmine short cut it will be automatically added to your environment.
You can find this under Bitnami installation folder.
If you are using Cloud9, just restart (command R) and try again
Sometimes it happens due to proxy you are using.
I tried to resolve this by using a connection without proxy and all worked perfectly fine.
Then try:
bundle update
And then go for
bundle install
For me, restarting the computer worked. I had already reinstalled ruby, updated bundler, removed 's' https:// but none of them worked!
A very simple solution I've used recently to overcome Bundler::HTTPError Could not fetch specs from https://rubygems.org/ which doesn't require you to disable IPV6 globally in your system:
ping -4 rubygems.org - to get an IPV4 address
Add the following line to your /etc/hosts file (use whatever IP address from the previous command output cause it might change):
151.101.129.227 rubygems.org
I just had to restart my wifi and it started working.
CHange your source form https to http after run
sudo bundle update
sudo bundle install
In my case the source of the problem was VPN. Disconnecting from it helped to resolve the issue.

Installing gem without the internet availability

Yesterday I tried to install rspec gem on a system which was not connected to internet, so this is what I did-
I downloaded the gem for rspec using the command gem install rspec and on command prompt its showing 5 gem inside the package - (system with internet conn)
diff-lcs-1.1.3, rspec-2.12.0, rspec-core-2.12.2, rspec-expectations-2.12.1, rspec-mocks-2.12.2
I copied the 5 folders from this location -
C:\RailsInstaller\Ruby1.9.3\lib\ruby\gems\1.9.1\gems
and pasted in the same path9system without internet connection),
when I updated the gem file with gem 'rspec' (computer without the internet connection) and restarted the server its still showing error.
I need to know if there is something else that updated during the installation which i am missing?
What other parts I need to add to make this rspec working on a computer without having internet connection.
PS- New to rails :)
To cache the gems execute bundle cache and it will save all the gem in vendor/cache directory.
When you you execute bundle install, it will use the cached gems.

Redmine installation - ruby rails 2.3.11 manual download

I am having a very hard time finding Rails 2.3.11 to download. I am trying to install this on Windows XP which Redmine 1.2.x requires this version. When I try to install the gem through the command prompt this is what I get:
C:\>gem install rails -v=2.3.11
ERROR: Could not find a valid gem 'rails' (=2.3.11) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEOUT: A connection attempt failed because the connected party ddi not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
I believe this problem is due to my highly secured internet connection. So I would like to manually download Rails 2.3.11. But I cannot find it. It seems it should be here: http://rubyforge.org/frs/?group_id=307 but the needed version 2.3.11 is not listed!
You are looking for http://rubygems.org/gems/rails/versions/2.3.11 ?
With manual installation you may get problems with dependecies (the needed gems must be loaded again manual when you use gem install xxx --local
Check this out
gem install -v=2.3.11 rails

Resources