"gem install rails" fails on Windows - ruby-on-rails

I am trying to manually install rails, but have encountered the following error:
c:\Ruby193\bin>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
Errno::ETIMEDOUT: A connection attempt failed because the connected party
did 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)
How can this be solved?
The steps I followed so far:
I installed Ruby from here: http://rubyinstaller.org/downloads/,
running the Ruby 1.9.3-p545 from the RubyInstaller section. (into
C:\Ruby193)
I installed also (for use with Ruby 1.8.7 and 1.9.3): the
DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe into C:\RubyDevKit.
I went to RubyDevKit in cmd and typed:
dir dk.rb
ruby dk.rb init
ruby dk.rb install
I launched irb (typed irb in C:\RubyDevKit) to confirm ruby
works and it does.

I am right now faced with this problem
Reset DNS cache solved that problem for me
(Run "ipconfig /flushdns" from cmd shell)

Related

gem install rails doesn't work due to openssl/ETimedout in windows

Initially, I have ruby 1.9.3 version installed in my windows 7 and i have installed ruby 2.0.0p195 recently and have tested from command promot (ruby -v; ruby -e "puts 100"; irb )works pretty well.
ruby -v gives ruby 2.0.0p195 (2013-05-14) [i386-mingw32]
gem -v gives me 2.0.2
When i'm trying to install rails, I do always get the below error :
with http://rubygems.org
C:\Users\san>gem install rails --source http://rubygems.org
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT:
A connection attempt failed because the connected party did not properly respon
d after a period of time, or established connection failed because connected hos
t has failed to respond. - connect(2) (https://rubygems.org/latest_specs.4.8.gz)
or
with https://rubygems.org
C:\Users\san>gem install rails --debug -V
Exception `Errno::EEXIST' at C:/Ruby200/lib/ruby/2.0.0/fileutils.rb:245 - File e
xists - C:/Users/san/.gem/specs/rubygems.org%443
HEAD https://rubygems.org/latest_specs.4.8.gz
Exception `OpenSSL::SSL::SSLError' at C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin
g.rb:174 - read would block
302 Moved Temporarily
HEAD https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
Exception `OpenSSL::SSL::SSLError' at C:/Ruby200/lib/ruby/2.0.0/openssl/bufferin
g.rb:174 - read would block
200 OK
GET https://rubygems.org/latest_specs.4.8.gz
Exception `Errno::ETIMEDOUT' at C:/Ruby200/lib/ruby/2.0.0/net/http.rb:878 - A co
nnection attempt failed because the connected party did not properly respond aft
er a period of time, or established connection failed because connected host has
failed to respond. - connect(2)
Since i'm getting so many errors, I have uninstalled both ruby versions and rebooted system and installed back (as suggested after googling and from few stackoverflow questions). But didn't help much.
Note: I have turned off windows firewall and tried installing. But I'm still getting Exception with openSSL issue.
Please suggest on this. Thanks!
The problem could be because you are behind proxy/firewall that blocks you from downloading from rubygems.org. See the below thread on rubygems.org for similiar issue:
http://help.rubygems.org/discussions/problems/799-ruby-gem-install-problems-on-windows-xp
Try using --http-proxy option while installing.
For people who are not able to make it work through --http-proxy, try the below. Added from the comment below.
gem install rails --http-proxy --source http://rubygems.org --debug -v

Installing Rails on Ubuntu behind the proxy

I am under Ubuntu 12.04 LTS.
I am behind the proxy.
I have installed rvm to manage ruby versions.
I would like to install the rails but I have encountered the problem:
test#U205-UBUNTU:~$ gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
I have tried different ways to force gem to use proxy setting:
1. gem install rails --http-proxy=http://10.10.16.8:3128
2. gem install rails -p=http://10.10.16.8:3128
3. export http_proxy=http://10.10.16.8:3128
4. I have added to .bashrc lines:
export http_proxy=http://10.10.16.8:3128
export https_proxy=https://10.10.16.8:3128
5. I have added to /etc/environment lines:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
http_proxy=http://10.10.16.8:3128
https_proxy=https://10.10.16.8:3128
But nothing helped me.
I am still getting the message:
test#U205-UBUNTU:~$ gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (http://rubygems.org/latest_specs.4.8.gz)
But apt-get and rvm work fine.
There was a problem with my proxy settings that restrict an access to Internet.
Sorry for incorrect question). The solution here is to add (as a superuser) the following to the file /etc/environment:
http_proxy=http://<proxy-host>:<proxy-port>
where
<proxy-host> is the real name of your proxy machine (or the ip address)
<proxy-port> is the port number you have to use
You don't have to set the proxy then for Gem.

Debugging error in Rails app running on Webrick server

I am running a Rails app on the webrick server and wanted to get error messages to be displayed to me in the console. I installed the debugger 'gem install debugger' and the installation went off without a glitch but when I restarted the server by typing in rails s --debugger, I got:
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Therefore I tried installing ruby-debug gem but I got the following error:
ERROR: Error installing ruby-debug:
ERROR: Failed to build gem native extension.
/Users/Me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
Can't handle 1.9.x yet
* extconf.rb failed *
My query is: what is going wrong with the installation? Secondly, what would be the best way for me to get error messages to be displayed to me?
For sure I'm late but just for anyone stuck on this, I had the same problem and fixed it by adding "gem 'debugger'" to the gemfile and running bundle update

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

Unable to start Rails server

The issue is when I try to start server with rails server command after successfully created Rails app by running rails new myapp -d=mysql. However, I cant get the server to start and it gives me the following error:
Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.
Then I run bundle install but could not happen.
I have installed:
Ruby 1.8.7
Rails 3.0.9 with mysql
RubyGems 1.8.7
I searched everywhere but nobody can solve my problem please help me with this issue as soon as possible. I am using Ubuntu 11.04.
Thanks in advance.
If your bundle install is saying everything is installed, try prefixing your rails command with
bundle exec rails server <other args here>
That will make sure you run the server in the context of the bundle (as defined by your Gemfile). If that fixes the problem for you, then you can either keep running the server using that command, or figure out what's wrong with your environment (might be a path issue, or you might have multiple versions of ruby or bundler installed and things aren't getting installed where you think they are)
i have reinstalled rails 4.2.4 using "gem install rails" command
and generated new project using rails new helloworld
"cd helloworld" and "rails server" would started my server.

Resources