简体   繁体   中英

Permission denied - connect(2) when trying to establish a web connection

This issue is getting me crazy, especially as everything was working before.

Every time I try to establish a web connection, I end up with a Permission denied - connect(2) error, for example trying to launch bundler:

Errno::EACCES: Permission denied - connect(2) for "bundler.rubygems.org" port 443
  C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:879:in `initialize'

Edit: to be clear the issue is not related to bundler, I get the same error message for the following code:

require 'net/http'
Net::HTTP.get('google.com', '/index.html')

gives me:

C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/net/http.rb:879:in `initialize': Permission denied - connect(2) for "food2fork.com" port 80 (Errno::EACCES)

Environment

    Bundler   1.11.2
    Rubygems  2.4.5.1
    Ruby      2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
    GEM_HOME  C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0
    GEM_PATH  C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0;C:/Users/user_name/.gem/ruby/2.2.0
    Git       2.7.2.windows.1

Change in your Gemfile .

source 'http://rubygems.org' (remove s from https)

Then run the following command. Hopefully it will solve your problem.

bundle install

Also there is already a connection open. connect(2) . So Stop another connection. Run one connection at a time. In a same port 2 connection can't be open.

"..everything was working before" Before what? (may reveal the cause)

First check it's not an issue with windows Firewall. Disable your firewall and try run bundle install again.

If that doesn't help, try changing the source line in your Gemfile to HTTP. ie from

source ' https://rubygems.org '

to

source ' http://rubygems.org '

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM