Newbie: Ruby on rails. Error message on rails installation - ruby-on-rails

I am trying to get the ruby on rails software on my computer(windows). But i have been getting this result when I input
gem install rails -v 4.2.3
in command prompt.
Error: could not find valid gem rails (=4.2.3)
here is why
Unable to download data from https://ruby_gems.org/- SSL_connect returned=1 errno=1 state=SSLv3 read server certificate B: certificate verify failed (htpps://api.rubygems.org/specs.4.8.gz)
How do I proceed so I can start using my ruby on rails to learn more?
Thanks

I'm assuming you followed some instructions like this one that uses the ruby installer to install Ruby and the needed dependencies.
Awhile ago I had an issue similar to this when I was behind a proxy trying to install a new gem. After googling I found I had to specify the source and proxy flags in the command to install the new gem.
gem install rails --source http://www.rubygems.org --http-proxy http://user:password#proxyip:port
But change the source as appropriate and remove the proxy flag if you're not behind one.

Thanks for the responses guys. But I needed a very basic answer since i am v v v new to this.
For anyone facing the same problem, i found an answer that worked and it just involved me writing this command in command prompt and it did the trick. will get to understanding how this all works as time goes on
https://github.com/jhu-ep-coursera/fullstack-course1-module1/wiki#q-what-to-do-when-rails-fails-to-update
gem source -r https://rubygems.org/
gem source -a http://rubygems.org/
gem update --system
gem install rails -v 4.2.3
Hope this helps other newbies.

Related

I'm getting "Error 403" when installing rails

I'm trying to install rails -v 5.2.2 on wsl ubuntu 18.04.
Im met with following error:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (https://api.rubygems.org/quick/Marshal.4.8/nokogiri-1.13.3-x64-unknown.gemspec.rz)
I'm relatively new to bash and I'm not sure what to do at this point, as google failed me. Help? :)
I had the same issue with -v 5.2.3. What worked for me was updating RubyGems with:
gem update --system
Then again:
gem install rails --version 5.2.3
and no issues this time.
Solution 1: As proposed by #Unixmonkey downloading the gem on separate machine with no restrictions and copying the gemfile worked.
Solution 2: Installing ruby through RVM and trusting its certificates

Couldn't install rails in windows 8.1

I had install ruby -version 2.2.4p230 but unable to install rails by using gem install rails. After writing this line in CMD the error saying Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
I had searched a lot about this but didn't get anything useful for me. Please do a help for installing the rails.
Exact same error. Another poster suggested this link. http://guides.rubygems.org/ssl-certificate-update/ but it didn't work for me.
ruby -v
ruby 2.2.5p319
gem --version
2.4.5.1
gem install rails
Error: could not find a valid gem 'rails' <>=0>, here is why: Unable to download data from links removed not enough rep to post* This page suggests a manual certificate fix which I will try next http://guides.rubygems.org/ssl-certificate-update/#background I am thinking the pem file is not located correctly.

Creating a Rails app in Windows

I have been trying to install Rails on my Windows PC for the past days. I got the bundle from www.railsinstaller.org and it installed great. When creating a new application I can see that all the app files are created then I get the following error:
bundle install
DL is deprecated, please use Fiddle Fetching gem metadata from
https://rubygems.org/.......... Resolving dependencies...
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0
state=SSLv3 read server certificate B : certificate verify failed
(https://rubygems.org/gems/rake-10.4.2.gem) An error occurred while
installing rake (10.4.2), and Bundler cannot continue. Make sure that
gem install rake -v '10.4.2' succeeds before bundling.
Hoping someone can help with resolving this.
This link could be helpful.
Creating a Ruby on Rails environment on Windows, in a VM Vagrant Box
Instead of install ROR directly onto Windows, you might want to use a Linux like OS. Not because Rails environment cannot be setup in Windows. But all the problems you will encounter, especially when most of tools are designed for that when you are not using a Linux like OS and try to mimic that.
But I highly recommend you skip doing all that if you are just trying to learn, and use Nitrous.io, which is an online IDE that gives you all the tool.
IMHO, dealing with Windows in this case is a waste of time.
First message:
DL is deprecated, please use Fiddle Fetching gem metadata ..
is a warning message. You read about it here.
The main error is encountered while installing rake.
An error occurred while installing rake (10.4.2), and Bundler cannot
continue. Make sure that gem install rake -v '10.4.2' succeeds before
bundling.
To solve this, you should first update Rubygems:
gem update --system
And then update Bundler:
gem install bundler
I simply run
gem update --system
and it fixed. More info please check bundle install fails with SSL certificate verification error

Could not find valid gem: certificate verify failed

I'm trying to establish an ssh tunnel to a remote server as described here: SSH from Heroku into remote server with Mysql Db
But I'm hung up just simply trying to download the gems. I added:
# file: Gemfile
...
gem 'net-ssh-gateway', '~> 1.2.0'
but when I do bundle install (or even just gem install net-ssh on the command line), I get:
ERROR: Could not find a valid gem 'net-ssh' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
As per the README for net-ssh (https://github.com/net-ssh/net-ssh), I checked my OpenSSL bindings for Ruby -- they look okay:
$ ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'
OpenSSL 1.0.1j 15 Oct 2014
I'm not sure if this is related, but when I tried to download the .pem file for a high security download of the gemfile:
$ curl -O https://raw.github.com/net-ssh/net-ssh/master/gem-public_cert.pem
... it didn't download a .pem file, and visiting the URL directly result in 'not found'.
Other info:
$ rake about
About your application's environment
Ruby version 2.1.4-p265 (x86_64-darwin14.0)
RubyGems version 2.2.2
Rack version 1.5
Rails version 4.1.7
So for right now, I'm stuck. Does anyone recognize this problem?
This helped in my case, when I had a problem with certificate:
gem sources -r https://rubygems.org
gem sources -a http://rubygems.org
gem update --system
gem sources -r http://rubygems.org
gem sources -a https://rubygems.org
Despite #the Tin Man's helpful answer, my problem was that I didn't have certificates set up in a place that OpenSSL could find them.
Following suggestions(s) in SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/:
An inferior workaround
One can work around this by changing the first line of Gemfile from
source 'https://rubygems.org'
to the non-https form:
source 'http://rubygems.org'
and then do the usual bundle install. Afterwards, you should restore the first line of your Gemfile to use the https form. This is generally considered a security risk.
What's more, you haven't really addressed the real problem that you lack valid certificates and you will run into trouble if your application calls uses OpenSSL (e.g. net-ssh).
A better fix
See SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/. For OS X users, we ask Ruby to tell us where it's looking for the certificates file, and then use security find-certificate to populate the certificates file:
$ cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
$ echo $cert_file
$ security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
$ security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"
After I did this, I was able to call bundle install without an error.
hey everyone follow this link so you wont have to manual install everytime.
This says that the problem is from rubygems' change of ssl certasdaasdlashjd blah blah. NVM the link explains it best :p

Gem error to install

I try to install rails but I am faced to the following error.
Has somebody any idea how to resolve it ?
C:\Users\Utilisateur>gem -v
2.0.14
C:\Users\Utilisateur>gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
C:\Users\Utilisateur>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/ - no such name (htt
ps://rubygems.org/latest_specs.4.8.gz)
Unable to download data from http://rubygems.org/ - no such name (http
://rubygems.org/latest_specs.4.8.gz)
First try to update ruby gems.
gem update --system
The issue most likely is with your internet connection.
If you see this issue again, try
gem install rails --source http://rubygems.org
You can add the not https source permanently like this
gem sources -a http://rubygems.org
Do you want to add this insecure source? [yn]y
I want to give you one more tip:
Don't develop rails on windows. Ruby and rails and many gems are very UNIXy in their ways. Install virtualbox and ubuntu on a virtual machine and run you development for there.
You might have proxy in your system. So use sudo http_proxy=http://host:port gem install rails.
I had the same issue but I ran the "Start command prompt with Ruby" as an administrator and tried the gem install rails and it worked.
I had to run 'gem install' as root to get this to work. I.e. 'sudo', which is less than ideal.
I suspect 'gem' has very poor error reporting and doesn't communicate the real cause from a permissions issue deep down the stack.
In my country for some strange reason rubygems.org domain is blocked. So a vpn was the solution for me.
My problem was I had configured a proxy in my network connection as #theBuzzyCoder said, so I simply changed my connection and it worked, I could install my gem (sass in my case)

Resources