' initialize':没有这样的文件或目录- getaddrinfo (Errno::ENOENT)当Rails新应用程序时

时间:2021-12-21 16:59:49

I try to create a rails app in rails 4.00 with ruby ruby-2.0.0-p247. While bundle install processes, it shows an error: initialize: No such file or directory. Below is output of error

我尝试用ruby-2.0 -p247在rails 4.00中创建一个rails应用程序。在bundle安装过程中,它显示了一个错误:初始化:没有这样的文件或目录。下面是错误的输出

 run  bundle install
 /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `initialize': No such file or directory - getaddrinfo (Errno::ENOENT)
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `open'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:878:in `block in connect'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:877:in `connect'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1449:in `begin_transport'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1402:in `transport_request'
from /home/gotzila/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:1376:in `request'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/net/http/persistent.rb:935:in `request'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:202:in `fetch'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:242:in `fetch_dependency_remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:151:in `fetch_remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:154:in `fetch_remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:154:in `fetch_remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:154:in `fetch_remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:106:in `specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:235:in `block in remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:235:in `each'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:235:in `remote_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <main>'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /home/gotzila/.rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.3.5/bin/bundle:20:in `<main>'

 Fetching gem metadata from https://rubygems.org/....Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!

What should i do to solve this problem?

我该怎么做才能解决这个问题?

2 个解决方案

#1


4  

I just had a similar issue and after reinstalling rvm (a headache) a couple days later it came back. This time I tried using comments to isolate which gems in my Gemfile were causing the problem. I noticed it was new gems. Then I tried to simply

我刚刚遇到了一个类似的问题,在重新安装rvm(一个令人头痛的问题)几天后,它又回来了。这一次,我尝试使用注释来隔离在我的Gemfile中哪些宝石导致了问题。我注意到它是新的宝石。然后我试着简单地说

gem install <problem_gem>

ERROR:  Could not find a valid gem 'problem_gem' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - no such name      (https://rubygems.org/latest_specs.4.8.gz)

This made me think I wasn't connected to the internet. Once I connected again.

这让我觉得我没有上网。当我再次连接。

bundle worked!

束工作!

bundle install

#2


0  

Clean and Reinstall new RVM and then try again..

清理并重新安装新的RVM,然后再试一次。

Follow this link to install new RVM:

按照这个链接安装新的RVM:

https://rvm.io/rvm/install

https://rvm.io/rvm/install

I faced similar problem and I installed the current stable version rvm 1.21.13 (stable) of RVM to get rid of this. Although my ruby version was 1.9.3 instead of 2.x

我遇到了类似的问题,我安装了rvm的当前稳定版本1.21.13 (stable)来摆脱这个问题。虽然我的ruby版本是1.9.3而不是2.x

#1


4  

I just had a similar issue and after reinstalling rvm (a headache) a couple days later it came back. This time I tried using comments to isolate which gems in my Gemfile were causing the problem. I noticed it was new gems. Then I tried to simply

我刚刚遇到了一个类似的问题,在重新安装rvm(一个令人头痛的问题)几天后,它又回来了。这一次,我尝试使用注释来隔离在我的Gemfile中哪些宝石导致了问题。我注意到它是新的宝石。然后我试着简单地说

gem install <problem_gem>

ERROR:  Could not find a valid gem 'problem_gem' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - no such name      (https://rubygems.org/latest_specs.4.8.gz)

This made me think I wasn't connected to the internet. Once I connected again.

这让我觉得我没有上网。当我再次连接。

bundle worked!

束工作!

bundle install

#2


0  

Clean and Reinstall new RVM and then try again..

清理并重新安装新的RVM,然后再试一次。

Follow this link to install new RVM:

按照这个链接安装新的RVM:

https://rvm.io/rvm/install

https://rvm.io/rvm/install

I faced similar problem and I installed the current stable version rvm 1.21.13 (stable) of RVM to get rid of this. Although my ruby version was 1.9.3 instead of 2.x

我遇到了类似的问题,我安装了rvm的当前稳定版本1.21.13 (stable)来摆脱这个问题。虽然我的ruby版本是1.9.3而不是2.x