I'm trying to install Jekyll on my Windows 10 computer. I have installed Ruby+Devkit successfully and their versions are:
$ ruby -v
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
$ gem -v
3.3.3
$ bundle -v
Bundler version 2.3.3
But when I ran any of these commands:
$ gem install jekyll
or
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
or
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.com
$ cd my-jekyll-repo
$ bundle install
or
ridk install
I was prompted with errors all including the message
Net::OpenTimeout: Failed to open TCP connection to localhost:1080 (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. - user specified timeout) (https://gems.ruby-china.com/specs.4.8.gz)
While I have installed Jekyll on other Windows 10 computers successfuly before I've never seen this error. I've searched in many places but couldn't find a solution. I don't understand why it's trying to connect to localhost:1080 but I tried to open the port from the firewall inbound rules as per this instruction and it doesn't work.
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
I just installed ruby version 2.3.0p0 using the ruby installer for windows and was trying to install bundler. When I run gem install bundler I get the following error:
Could not find a valid gem 'bundler' (>=0), here is why
Unable to download data from (link removed) rubygems -Errno:ETIMEDOUT:
Failed to open TCP connection to api.rubygems.org:443 (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) for "api.rubygems.org" port 443)(https://api.rubygems.org/specs.4.8.gz)
Some research led me to try running gem install --http-proxy http://[user]:[password]#[server]:[port] which i think might work because I am behind a proxy here and a similiar solution helped me clone a git repository earlier.
But when i tried this command I got the following error:
ERROR: While executing gem ... (Gem:CommandLineError)
Please Specify at least one gem name (e.g. gem build GEMNAME)
UPDATE
So I tried that gem install --http-proxy.... command again with the gem name at the end and I am back to getting the original TCP connection error above. I am pretty sure the login information I entered is correct. I also added --source http://... instead of the https one but still am having the same problem?
1st off your error is pretty telling-
ERROR: While executing gem ... (Gem:CommandLineError) Please Specify
at least one gem name (e.g. gem build GEMNAME)
2nd make sure you have met the requirements for what you're trying to do http://bundler.io/
then run the code..
gem install bundler
bundle init
echo 'gem "rspec"' >> Gemfile
bundle install
bundle exec rspec
In 2023, the best way to install bundler on an old version of Ruby is:
gem update --system
RubyGems and Bundler now ship together, so to get the latest bundler, you should just install the latest RubyGems.
would you try disable ipv6, it had been worked for me
I was trying to install compass on my OS X terminal using the following command:
sudo gem install compass
but an error prompt:
ERROR: Could not find a valid gem 'compass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Connection refused - Connection refused (https://rubygems.org/latest_specs.4.8.gz) ERROR: Possible alternatives: compass
What's causing this?
I then googled and found the same issue here:
Errno::ECONNREFUSED No connection could be made because
But I don't understand how the following command can resolve the issue:
Try to use environment variables to set the proxies:
export http_proxy="http://user:pass#server.com:port"
export HTTP_PROXY="http://user:pass#server.com:port"
I am only installing compass on my localhost. What should the USER, PASS, and #SERVER be replaced with?
Thank you in advance
I have successfully installed compass now after fixing my proxy via this link:
http://www.cyberciti.biz/faq/linux-unix-set-proxy-environment-variable/
Basically I just did the following commands on the terminal:
$ export http_proxy=http://server-ip:port/
$ export http_proxy=http://127.0.0.1:3128/
I'm trying to install the bundler gem using $ gem install bundler. When I execute the command, I receive the following response:
ERROR: Could not find a valid gem 'bundler' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR: Possible alternatives: bundler
In an effort to make sure I wasn't going crazy, I tried installing nokogiri:
ERROR: Could not find a valid gem 'nokogiri' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/latest_specs.4.8.gz)
ERROR: Possible alternatives: nokogiri
And a2z:
ERROR: Could not find a valid gem 'a2z' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ETIMEDOUT: Operation timed out - connect(2) (https://api.rubygems.org/quick/Marshal.4.8/a2z-0.1.3.gemspec.rz)
If anyone has experience this issue before and can help me out it would be greatly appreciated.
If it helps, I'm running MacOS Mavericks and have gem version 2.2.2.
Too Late but i resolve this issue disabling the IPv6 connections in my system OS.
It forces the OS just use the IPv4 and then it works.
In your Gemfile set your
source 'http://production.s3.rubygems.org'
This may not be an official answer, but it worked for me after three frustrating days trying to access rubygems.org.
For people using Windows, the following worked for me on Windows 10. See also my reply on the ruby gems issues list.
Go to Control Panel > Network and Internet > Network connections
Select the network connection you're currently using
Right click on it and choose Properties
Remove check mark for Internet Protocol version 6 (TCP/IPv6)
Click OK
Run your gem command again
i had the same issue which i solved by disabling my VPN. try looking at proxies, VPNs, and other networking issues.
api.rubygems.org is having issues with IPV6 host address. I faced the same issue after I setup the ubuntu server in vbox. We need to configure it to use our host's IPV4 first and then try IPV6.
So we can change the priority by adding this line ti /etc/gai.conf:
# Debian defaults.
precedence ::1/128 50
precedence ::/0 40
precedence 2002::/16 30
precedence ::/96 20
precedence ::ffff:0:0/96 10
# Low precedence for api.rubygems.org IPv6 addresses.
precedence 2a04:4e42::0/32 5
And it worked like a charm!
ping rubygems.org and get the IP address.
Edit your /etc/hosts file and add the line: <IPADD> rubygems.org.
gem update --system.
For the people using macOS, the following worked me on macOS 12.3.1.
Go to System Preferences > Network
Click on the Advanced... button
Go to TCP/IP tab on the top
Change Configure IPv6 from Automatically to Manually
Click on the OK
Click on the Apply
Re-try installing your gems
Revert the changes back
just add --source http://rubygems.org to your installs. The issue most likely is with your internet connection.
In my case helped the following:
sudo gem update --system
Disable ipv6
sudo gem update --system
gem install bundler
I encountered this just now. I needed to disable IPv6. I had to set mine to link-local only to get it to work. Otherwise, it's the same as #chootti's list:
Go to System Preferences > Network
Click on the Advanced... button
Go to TCP/IP tab on the top
Change Configure IPv6 from Automatically to Link-local only
Click on OK
Then I ran sudo gem update --system to update RubyGems. I still couldn't install gems with IPv6 enabled, so it looks like that needs to be off to install from RubyGems.
Machine this worked on:
OS: MacOS Monterey 12.4
Machine: Apple M1 (2020)
Ruby install manager: ASDF
dig api.rubygems.org +short
Adding below line to /etc/hosts worked for me.
151.101.192.70 rubygems.org
I ran into the same issue. Try running:
bundle pristine