在cygwin和powershell中看到不同的gem列表 [英] seeing different gem lists in cygwin and powershell

查看:263
本文介绍了在cygwin和powershell中看到不同的gem列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在powershell和cygwin中使用了 gem list 命令,并显示不同的gem列表。
Cygwin显示

  *** LOCAL GEMS *** 

bundler 3)
json(1.7.5)
minitest(2.12.1)
rake(0.9.2.2)
rdoc(3.12)



在PowerShell中我看到:

  ** LOCAL GEMS *** 

io-console(0.3)
json(1.5.4)
minitest(2.5.1)
rake )
rdoc(3.9.4)
sass(3.2.1)

所以,同一个gem的版本也有两个不同。



为什么会这样?此外,在使用rails(int cygwin和Powershell)时,我遇到了 bundle install 的问题。是否因为这个原因?



如何确保宝石的一致性?不通过Powershell / cygwin安装gem使它可用于整个系统?



所以,我想安装一个gems和Rails的新副本,这在Powershell和cygwin中是一致的。我如何做到这一点?



在cygwin中运行 gem环境

  RubyGems环境:
- RUBYGEMS版本:1.8.23
- RUBY VERSION:1.9.3(2012-11-10 patchlevel 327) [i386-cygwin]
- 安装目录:/usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE:/usr/bin/ruby.exe
- EXECUTABLE DIRECTORY:/ usr / bin
- RUBYGEMS平台:
- ruby​​
- x86-cygwin
- GEM PATHS:
- /usr/lib/ruby/gems/1.9.1
- /cygdrive/c/SPB_Data/.gem/ruby/1.9.1
- GEM配置:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE来源:
- http://rubygems.org/

在Windows PowerShell中它给出:

  RubyGems环境:
- RUBYGEMS版本:1.8.23
- RUBY VERSION:1.9.3(2012-04-20 patchlevel 194)[i386-mingw32]
- 安装目录:C:/Ruby193/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE :C:/Ruby193/bin/ruby.exe
- EXECUTABLE DIRECTORY:C:/ Ruby193 / bin
- RUBYGEMS平台:
- ruby​​
- x86-mingw32 $ b b - GEM PATHS:
- C:/Ruby193/lib/ruby/gems/1.9.1
- C:/SPB_Data/.gem/ruby/1.9.1
- GEM配置:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE来源:
- http://rubygems.org/


解决方案

我只能猜测根据你给出的信息,但它听起来像你有一个单独的版本的ruby安装在cygwin和windows。



一个简单的方法来告诉发生了什么是做一个 ruby​​ -v gem环境两个shell,它会告诉你你使用的ruby版本,以及ruby认为它使用的版本,以及Rubygems在寻找gems。



为了确保gems的一致性在windows上,我建议安装一个ruby并使用Bundler通过Gemfile维护您的宝石。删除通过cygwin安装的ruby,并确保使用的ruby在两个环境中都是相同的(尝试 ruby​​ -v



但是,我不知道为什么你会根据你提供的信息收到bundler错误。



EDIT AFTER UPDATE



所以你绝对有两个不同版本的ruby安装,每个都有自己独特的gems。你不能使用cygwin的windows版本,所以我会做的是卸载cygwin版本(使用cygwin setup.exe来做这个!如果你没有它,请从cygwin网站下载它。要删除和添加),并确保 / cygdrive / c / ruby​​193 / bin 在您的cygwin路径,因此 which ruby​​ which gem 指向此目录。


I used the gem list command in powershell and cygwin and both show different gem lists. Cygwin shows

*** LOCAL GEMS ***

bundler (1.2.3)
json (1.7.5)
minitest (2.12.1)
rake (0.9.2.2)
rdoc (3.12)

while in powershell I see :

*** LOCAL GEMS ***

io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.4)
sass (3.2.1)

So, the versions of same gem are also different in two.

Why is it so? Also, I was getting problems with bundle install while using rails(int both Cygwin and Powershell). Can it be because of this?

How do I ensure consistency in gems? Doesn't installing a gem via Powershell/cygwin make it available to the entire system?

So, I would like to install a fresh copy of gems and Rails which is consistent across Powershell and cygwin. How do I do that?

running gem environment in cygwin gives this:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [i386-cygwin]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/bin/ruby.exe
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-cygwin
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.9.1
     - /cygdrive/c/SPB_Data/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

and in windows powershell it gives :

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/Ruby193/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-mingw32
  - GEM PATHS:
     - C:/Ruby193/lib/ruby/gems/1.9.1
     - C:/SPB_Data/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

解决方案

I can only guess based on what information you have given, but it sounds like you have a separate version of ruby installed in cygwin and windows.

One easy way to tell what's going on is to do a ruby -v and gem environment in both shells, which will tell you which ruby version you are using, and what version ruby thinks it's using, and where Rubygems is looking for gems.

To ensure consistency in gems on windows, I would suggest having one ruby installed and using Bundler to maintain your gems through Gemfile. Remove the ruby you installed through cygwin, and ensure the ruby you use is the same one in both environments (try ruby -v)

However, I'm not sure why you're getting bundler errors based on the information you've given.

EDIT AFTER UPDATE

So you definitely have two different versions of ruby installed, each with their own unique set of gems. You cannot use the windows version in cygwin, so what I would do would be uninstall the cygwin version (use the cygwin setup.exe to do this! If you don't have it, download it again from the cygwin website. You can indicate packages to remove as well as add) and make sure the /cygdrive/c/ruby193/bin is in your cygwin path, so that which ruby and which gem points at this directory.

这篇关于在cygwin和powershell中看到不同的gem列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆