无法添加gem来源

时间:2016-05-02 13:18:12

标签: ruby rubygems

我正在尝试在我的来源中添加http://rubygems.org/因为我无法使用'gem install NAME'(此错误:无法在任何存储库中找到有效的宝石'破折'(> = 0) )。

所以,我做了这个命令:gem sources -a http://rubygems.org/

结果:错误:执行gem时...(Gem :: OperationNotSupportedError)     未连接到tty且未指定默认值

我告诉你我的ENV:

    $ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.5.1
  - RUBY VERSION: 2.2.4 (2015-12-16 patchlevel 230) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0
  - RUBY EXECUTABLE: C:/RailsInstaller/Ruby2.2.0/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/RailsInstaller/Ruby2.2.0/bin
  - SPEC CACHE DIRECTORY: C:/Users/mramart/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0
     - C:/Users/mramart/.gem/ruby/2.2.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => []
  - REMOTE SOURCES:
  - SHELL PATH:
     - C:\Users\mramart\bin
     - C:\Program Files (x86)\Git\mingw32\bin
     - C:\Program Files (x86)\Git\usr\local\bin
     - C:\Program Files (x86)\Git\usr\bin
     - C:\Program Files (x86)\Git\usr\bin
     - C:\Program Files (x86)\Git\mingw32\bin
     - C:\Program Files (x86)\Git\usr\bin
     - C:\Users\mramart\bin
     - C:\RailsInstaller\Git\cmd
     - C:\RailsInstaller\Ruby2.2.0\bin
     - C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
     - C:\Tcl\bin
     - C:\ProgramData\Oracle\Java\javapath
     - C:\WINDOWS\system32
     - C:\WINDOWS
     - C:\WINDOWS\System32\Wbem
     - C:\WINDOWS\System32\WindowsPowerShell\v1.0
     - C:\WINDOWS\System32\WindowsPowerShell\v1.0
     - C:\Program Files (x86)\Lenovo\Access Connections
     - C:\Program Files\nodejs
     - C:\Program Files\Java\jdk1.7.0_79\bin
     - C:\Program Files (x86)\Heroku\bin
     - C:\Program Files (x86)\git\cmd
     - C:\Program Files\TortoiseSVN\bin
     - C:\Program Files\PostgreSQL\9.5\bin
     - C:\Program Files (x86)\scala\bin
     - D:\gatling-charts-highcharts-bundle-2.1.7\bin
     - C:\Program Files (x86)\sbt\bin
     - %USERPROFILE%\.dnx\bin
     - C:\Program Files\Microsoft DNX\Dnvm
     - C:\Program Files\Microsoft SQL Server\130\Tools\Binn
     - C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit
     - C:\Users\mramart\AppData\Roaming\npm
     - C:\Program Files\Java\jdk1.8.0_73\bin
     - C:\apache-maven-3.0.5\bin
     - C:\Program Files\PostgreSQL\9.5\bin
     - C:\Program Files\MongoDB\Server\3.2\bin
     - D:\liquid
     - C:\Users\mramart\AppData\Local\atom\bin
     - C:\Program Files (x86)\Git\usr\bin\vendor_perl
     - C:\Program Files (x86)\Git\usr\bin\core_perl

没有执行任何来源:宝石来源

1 个答案:

答案 0 :(得分:6)

在这种情况下,我直接更改我的Gem Config文件。以下是~/.gemrc的更新版本:

---
:backtrace: false
:bulk_threshold: 1000
:sources:
- http://rubygems.org
:update_sources: true
:verbose: true

以下是验证方法:

$ gem sources
http://rubygems.org/