Error on installing Pod - ruby

Recently I have needed to install pod file. I have tried by
$ sudo gem install cocoapods
but after several seconds after entering password, I got bellow error:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from http://rubygems.org/ - Errno::EHOSTUNREACH: No route to host - connect(2) (http://rubygems.org/latest_specs.4.8.gz)
I searched this error, I found some questions similar, such as Stack question but none of solution resolved my problem. If there is any other way to try, please let me know.

I fixed this problem by changing my network to guest network. My main network has proxy authentication that prevented me from downloading the ruby from repo.
Steps to follow:
1.Switch to a different network
2. In terminal"sudo gem install cocoapods"
3.Close and restart terminal
4. Do "pod install"

The problem is fixed. The only change I have made on my system is installing the last stable version of node. Because I am not expert I can not explain how it solved.

Related

Installing gems with no network

I have to install several gem files on a machine that does NOT have an internet connection. To do this, I imported the packages from a machine that is connected to the internet and copied the files to the offline machine. I followed this guide for the installation, but it is deprecated. In fact, the result is as follows:
gem install --force --local *.gem
ERROR: Could not find a valid gem '*.gem' (>= 0) in any repository
My question is: how can I install these 20/30 different gems without internet? Is there another way?
Thank you!
Update:
I tried again folder by folder to install the gems, first with "gem build" and then "gem install".
The result:
WARNING: Unable to pull data from 'https://rubygems.org/': Errno::ENETUNREACH: Failed to open TCP connection to rubygems.org:443 (Network is unreachable - connect(2) for "rubygems.org" port 443) (https://rubygems.org/specs.4.8.gz)
1 gem installed
Could be a proxy problem?
Found the solution.
Basically 2 Problems:
If i wanted to install the gems from the gem folder, i had first to run the build and after the install.
But i could also install the gems placed inside the cache folder, and inside this folder run directly "gem install --force --local".
Thank you all of you for your answers.

bundle install gives error Bundler::HTTPError Could not fetch specs from http://rubygems.org/

Running bundle install gave the following
Fetching source index from https://rubygems.org/
Retrying fetcher due to error (2/4): Net::HTTPServerException 403 "Forbidden"
Retrying fetcher due to error (3/4): Net::HTTPServerException 403 "Forbidden"
Retrying fetcher due to error (4/4): Net::HTTPServerException 403 "Forbidden"
Could not fetch specs from https://rubygems.org/
Followed this and changed to http in Gemfile. Problem Still exists. I didn't install any other ruby version. Default on Mac Ruby version : ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18], bundle version 2.0.1.
Running bundle update then gave
Authentication is required for http://rubygems.org/. Please supply credentials for this source. You can do this by running: bundle config http://rubygems.org/ username:password
No idea what the credentials should be, but I signed up at rubygems.org and used that username/password (Pardon if that was silly) and got
Bad username or password for http://username#rubygems.org/. Please double-check your credentials and correct them.
Followed this and turned off IPV6 and still same problem.(If anything the errors showed up a little faster)
Infact now realised none of the gem command works and gives errors like
gem install jekyll bundler
ERROR: While executing gem ... (Net::HTTPServerException)
403 "Forbidden"
While I did install jekyll and bundler yesterday. Today I ran bundle exec jekyll serve and got
Could not find gem 'minima (~> 2.0)' in any of the gem sources listed in your Gemfile.
Run bundle install to install missing gems.
Hence, it all started with trying to get Jekyll working.
OS : MacOS(10.14.3)
So I have a proxy in my organization's network which I knew would cause problems so I was infact using a different network. I finally tried to comment out the proxy settings in my .bash_profile, and it was still giving the same errors. I shut down the system and then tried again and it worked.
Such a bummer. Anyway I'm not deleting the question hoping for a better work around than this. I mean if every time I want to use gem I have to do this it's kind of a hassle.
Using http instead of https in your Gemfile should do the trick.
Use:
http://rubygems.org
Disable IPv6 and HTTPS .
(Windows) -
Open Gem file and replace :
source "https://rubygems.org"
with
source "http://rubygems.org"
then , Go To Control Panel\Network and Internet\Network Connections
Right Click on your adapter , and select properties .
Untick IPv6 there

Unable to install bundler/gems after upgrading jruby and rubymine version (SSLError)

So recently I was encountering some SSL cert issues so in order to help fix that, I've upgraded our jruby 1.7.4 to jruby 9.1.15 and our RubyMine to 2018.2.1 (team using Ruby Cucumber).
However, now we're facing an issue installing /updating gems and bundler after the upgrade.
We're trying to install from the command prompt:
$ set HTTP_PROXY=https://username:password#proxyurl.net:port
$ gem install bundler
And receiving the error:
ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
Received fatal alert: protocol_version
Before setting the proxy the error was:
WARNING: Unable to pull data from 'https://rubygems.org/':
SocketError: Failed to open TCP connection to rubygems.org:443
(initialize: name or service not known)
(https://rubygems.org/specs.4.8.gz)
1 gem installed
I've even tried going to a Starbucks to avoid the proxy altogether but am still getting a similar error.
Just to add in trying to install bundler in RubyMine itself doesn't work.
So somehow I fixed it.. I'm not able to reproduce the fix but that might be related to some foundation problems the fix caused.
Basic steps I used (any of these might help):
Removed versions from gemfile
Trying to install bundler from outside proxy
Install bundler through command prompt and install gems through RubyMine
Change gemfile source to 'http' instead of 'https'
Will update more if I find how to reproduce fix

'no such name' error on all gem install attempts

I just installed Ruby 2.2.2 on a Windows 7 64-bit VM. Every gem install <gemname> attempt fails with the following error:
ERROR: Could not find a valid gem '<gemname>' ()= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name
(https://api.rubygems.org/specs.4.8.gz)
However, the list generated by the gem list contains the gem that I thought failed. Is it actually installed or not? I assume it isn't but even if it is, the error concerns me.
I know that I am working behind a proxy so I've tried appending --http-proxy but that hasn't helped either.
Any ideas to troubleshoot this? Thanks!
It's possible that one of the gems that you installed declares an invalid dependency such as <gemname> (specifically).
To validate this, open an irb or pry console and run Gem.loaded_specs to see if the string <gemname> shows up anywhere.
You could also try updating your rubygems with gem update --system.
And finally, you could also try to run gem check to validate all installed gems.
Unfortunately, this appears to be an issue that needs to be investigated to get to the root cause.
I ran into the same issue before figuring out my session was fucked up. Indeed the command whoami was displaying an id and not my username. I logged out and logged in again and everything was solved.

Can't install any gems

I have been doing JavaScript and some Erlang for around six months and I haven't done any Rails programming lately. Today on my new PC I went to install Rails but got this error:
gem install rails
WARNING: RubyGems 1.2+ index not found for:
http://gems.rubyforge.org/
RubyGems will revert to legacy indexes degrading performance.
Bulk updating Gem source index for: htp://gems.rubyforge.org/
ERROR: While executing gem ... (Gem::RemoteSourceException)
Error fetching remote gem cache: SocketError: getaddrinfo: The system cannot
find the file specified. (http://gems.rubyforge.org/yaml)
A friend of mine said: "gem -v?" to which I responded "1.3.5". He suggested I update to 1.3.6 but I had the same problem. Then I installed a few gems for testing purposes from github.
I don't know if I'm missing a source or something, or if something changed drastically in gems.
Also:
gem sources -a htp://gemcutter.org/
Error fetching htp://gemcutter.org/:
SocketError: getaddrinfo: The system cannot find the file specified. (http://gemcutter.org/specs.4.8.gz)
For Mac OSX the solution that worked for me was:
sudo gem install rubygems-update --source http://production.s3.rubygems.org/
sudo gem update --system --source http://production.s3.rubygems.org/
It comes from some file on github of all places.
Try reinstalling rubygems from scratch here: http://rubygems.org/pages/download
RubyForge has been deprecated and may no longer be working properly. The other possibility is that when you tried to do this rubyforge or gemcutter was down, or otherwise not accessible over your network. You can also try seeing if you can reach the file on rubygems by entering it in your browser (to test your network): http://gemcutter.org/specs.4.8.gz
This question has previously been asked here: RubyGems 1.2+ index not found for:. It appears the problem was that rubyforge was blocked by China's firewall.
Good luck!

Resources