Ruby Gems 和 dugway 安装非常迷失

Posted

技术标签:

【中文标题】Ruby Gems 和 dugway 安装非常迷失【英文标题】:Pretty lost with Ruby Gems and dugway installation 【发布时间】:2013-07-26 04:58:34 【问题描述】:

我想使用 Big Cartel 名为 Dugway 的 Ruby Gem 在本地环境中创建主题,而不是在其实际平台上创建主题。

我以前从未使用过 Ruby 或 Gems,但据我了解,我需要先安装 Ruby 和 DevKit。我下载并安装了Ruby 2.0.0-p247 (x64)DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe,然后将DevKit解压到Ruby文件夹中。

我遵循了here 的说明,但为了将所有内容保存在一个地方,无论如何我都会写下我所做的...

我打开 Start Command Prompt With Ruby 并输入 cd C:\Ruby200-x64\devkit 然后 ruby dk.rb init 并得到了这个:

    Initialization complete! Please review and modify the auto-generated
    'config.yml' file to ensure it contains the root directories to all
    of the installed Rubies you want enhanced by the DevKit.

我查看了文件,在评论下方有- C:/Ruby200-x64,我认为这意味着因为我以前没有使用过任何东西,所以无论如何我都没有什么可以修改的。

现在要安装,我输入 ruby dk.rb install 并显示:

    [INFO] Updating convenience notice gem override for 'C:/Ruby200-x64'
    [INFO] Installing 'C:/Ruby200-x64/lib/ruby/site_ruby/devkit.rb'

然后它告诉我进行测试安装,所以我输入了gem install json --platform=ruby,它给了我以下信息:

    Fetching: json-1.8.0.gem (100%)
    Temporarily enhancing PATH to include DevKit..
    Building native extensions. This could take a while...
    Successfully installed json-1.8.0
    Parsing documentation for json-1.8.0
    Unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/generator.so, skipping
    Unable to convert "\x90" from ASCII-8BIT to UTF-8 for lib/json/ext/parser.so, skipping
    Installing ri documentation for json-1.8.0
    1 gem installed

我在这里快速搜索了有关无法转换警告的信息,发现 this 这让我感觉好多了,因为这不是错误,这意味着我继续输入 ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect" 并显示 [42] 哪个我以为它工作正常!

所以现在开始使用 Big Cartels Dugway gem,我输入 gem install dugway 这给了我错误:

    ERROR: While executing gem ... (Gem::DependencyError)
    Unable to resolve dependencies: dugway requires i18n (= 0.6.1)

快速搜索告诉我 i18n 本身就是一个 gem,所以......我刚刚学到的关于如何安装 gems 的假设让我认为应该将gem install i18n 写入命令提示符,这样安装时没有警告或错误谢天谢地。所以我尝试再次安装 dugway gem install dugway 并得到与以前完全相同的错误,即 dugway 需要 i18n。

我现在很困惑,说一个小时前我不知道这意味着什么,我以为我到目前为止做得很好,但我不知道下一步该做什么。

如何解决最后一个错误,对我来说它已安装,我做错了什么?很抱歉,如果这很明显,但就像我说的,这对我来说都是全新的,我已经习惯了只写 php 和运行数据库,所以我还在调整!

编辑

请注意,我还尝试在 gem install dugway 末尾添加 --platform-ruby 以防万一出现问题,但仍然出现相同的错误。

编辑

在遵循 Simon Repp 的强制安装特定 i18n 版本的建议后:

ruby 2.0.0p247 (2013-06-27) [x64-mingw32]

C:\Users\Me>cd C:\Ruby200-x64\devkit

C:\Ruby200-x64\devkit>gem list i18n

*** LOCAL GEMS ***

i18n (0.6.4)

C:\Ruby200-x64\devkit>gem install i18n --version '= 0.6.1'
Fetching: i18n-0.6.1.gem (100%)
Successfully installed i18n-0.6.1
Parsing documentation for i18n-0.6.1
Installing ri documentation for i18n-0.6.1
1 gem installed

然后再次尝试安装dugway,一切顺利,直到结束:

C:\Ruby200-x64\devkit>gem install dugway
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
Fetching: rack-1.4.5.gem (100%)
Successfully installed rack-1.4.5
Fetching: rack-mount-0.8.3.gem (100%)
Successfully installed rack-mount-0.8.3
Fetching: activesupport-3.2.14.gem (100%)
Successfully installed activesupport-3.2.14
Fetching: liquid-2.4.1.gem (100%)
Successfully installed liquid-2.4.1
Fetching: coffee-script-source-1.6.3.gem (100%)
Successfully installed coffee-script-source-1.6.3
Fetching: execjs-1.4.0.gem (100%)
Successfully installed execjs-1.4.0
Fetching: coffee-script-2.2.0.gem (100%)
Successfully installed coffee-script-2.2.0
Fetching: sass-3.2.9.gem (100%)
Successfully installed sass-3.2.9
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: sprockets-2.10.0.gem (100%)
Successfully installed sprockets-2.10.0
Fetching: sprockets-sass-0.9.1.gem (100%)
Successfully installed sprockets-sass-0.9.1
Fetching: chunky_png-1.2.8.gem (100%)
Successfully installed chunky_png-1.2.8
Fetching: fssm-0.2.10.gem (100%)
Successfully installed fssm-0.2.10
Fetching: compass-0.12.2.gem (100%)
Successfully installed compass-0.12.2
Fetching: multi_xml-0.5.4.gem (100%)
Successfully installed multi_xml-0.5.4
Fetching: httparty-0.10.2.gem (100%)
When you HTTParty, you must party hard!
Successfully installed httparty-0.10.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: coderay-1.0.9.gem (100%)
Successfully installed coderay-1.0.9
Fetching: better_errors-0.6.0.gem (100%)
Successfully installed better_errors-0.6.0
Fetching: debug_inspector-0.0.2.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed debug_inspector-0.0.2
Fetching: binding_of_caller-0.7.2.gem (100%)
Building native extensions.  This could take a while...
Successfully installed binding_of_caller-0.7.2
Fetching: will_paginate-3.0.4.gem (100%)
Successfully installed will_paginate-3.0.4
Fetching: htmlentities-4.3.1.gem (100%)
Successfully installed htmlentities-4.3.1
Fetching: thor-0.17.0.gem (100%)
Successfully installed thor-0.17.0
Fetching: rubyzip-0.9.9.gem (100%)
Successfully installed rubyzip-0.9.9
Fetching: uglifier-1.3.0.gem (100%)
Successfully installed uglifier-1.3.0
Fetching: eventmachine-1.0.3.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing dugway:
        ERROR: Failed to build gem native extension.

C:/Ruby200-x64/bin/ruby.exe extconf.rb
checking for main() in -lssl... no
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... no
checking for __NR_inotify_init in sys/syscall.h... no
checking for writev() in sys/uio.h... no
checking for rb_wait_for_single_fd()... yes
checking for rb_enable_interrupt()... no
checking for rb_time_new()... yes
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
creating Makefile

make "DESTDIR="
generating rubyeventmachine-x64-mingw32.def
compiling binder.cpp
In file included from c:\ruby200-x64\devkit\mingw\bin\../lib/gcc/x86_64-w64-ming
w32/4.7.2/../../../../x86_64-w64-mingw32/include/process.h:12:0,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/win32.h:60,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/defines.h:153,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby/ruby.h:70,
                 from c:/Ruby200-x64/include/ruby-2.0.0/ruby.h:33,
                 from em.h:24,
                 from project.h:150,
                 from binder.cpp:20:
c:\ruby200-x64\devkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../
x86_64-w64-mingw32/include/sys/types.h:68:16: error: conflicting declaration 'ty
pedef _pid_t pid_t'
In file included from binder.cpp:20:0:
project.h:97:13: error: 'pid_t' has a previous declaration as 'typedef int pid_t
'
In file included from project.h:151:0,
                 from binder.cpp:20:
ed.h: In member function 'void EventableDescriptor::SetSocketInvalid()':
ed.h:43:40: warning: overflow in implicit constant conversion [-Woverflow]
make: *** [binder.o] Error 1


Gem files will remain installed in C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/event
machine-1.0.3 for inspection.
Results logged to C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/ext
/gem_make.out

C:\Ruby200-x64\devkit>

【问题讨论】:

【参考方案1】:

我已经通过卸载 Ruby 和 DevKit 的 64 位版本来使其正常工作。

如果其他人想知道我是如何工作的,我完全删除了 Ruby 和 DevKit,并下载了 Ruby 2.0.0-p247DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

Ruby 安装到 C:\Ruby200\,我将 DevKit 提取到 C:\Ruby200\devkit\

打开 Ruby 命令提示符并执行以下操作:

更改路径,初始化然后安装。像他们在RubyInstall DevKit 上所说的那样通过安装 json 对其进行了测试(再次出现几个关于 ASCII 到 UTF-8 转换的警告,但没有错误)。

测试了 json 安装,然后安装了 i18n 0.6.1 版本,因为这是 Dugway 所说的要求。试图安装 Dugway 但它说activesupport requires i18n (>= 0.6.4, ~> 0.,所以我安装了 0.6.4 的 i18n 看看是否会安装 Dugway。

再次安装 Dugway,经过漫长的等待解析和安装更多 ASCII 到 UTF-8 的转换,但 Dugway 终于安装了!

这是我使用的命令列表,删除了所有结果以便于阅读:

C:\Users\Me> cd C:\Ruby200\devkit
C:\Ruby200\devkit> ruby dk.rb init
C:\Ruby200\devkit> ruby dk.rb install
C:\Ruby200\devkit> gem install json --platform=ruby
C:\Ruby200\devkit> ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect
C:\Ruby200\devkit> gem install i18n --version '= 0.6.1'
C:\Ruby200\devkit> gem install i18n
C:\Ruby200\devkit> gem install dugway

希望能帮助和我一样遇到问题的人,因为我对 Ruby 或 Gems 了解不多,就像我说的那样,我不知道 64 位版本是否有问题,或者是否它在 dugways 尽头,但不管怎样,这对我有用!

使用 dugway 本身仍然存在问题,但至少它已安装,我将就我现在面临的问题与 dugway 本人联系。

【讨论】:

如果您报告这些有关在 wnidows 上使用 ruby​​ 时遇到的问题,那就太好了。不过,我发现重要的是要注意大多数 ruby​​ 社区更喜欢在 *nix 系统(通常是 linux 或 MacOS)上工作,并且作为初学者在其中一个系统上使用 ruby​​ 会更容易。 【参考方案2】:

使用gem list i18n,您可以获得您安装的 i18n gem 的版本信息。 (应该用括号括起来,比如i18n (x.x.x)

您安装的版本可能不是 0.6.1(根据您的错误消息,这正是 dugway 工作所需的 i18n 的确切版本)

如果是这样,您可以尝试gem install i18n --version '= 0.6.1' 自己安装该特定版本。

不幸的是,这很有可能会失败,因为如果可以像这样为您安装 gem,rubygems 可能已经为您完成了。但是 - 无论您在尝试此操作时遇到什么错误,都会导致您发现问题的更深层原因,因此至少会更进一步;)

【讨论】:

嗯,它比上次更进一步,非常感谢版本安装!我试图理解它引发的错误,但运气不佳!用结果编辑了我原来的问题。

以上是关于Ruby Gems 和 dugway 安装非常迷失的主要内容,如果未能解决你的问题,请参考以下文章

Ruby(bundle install,bundle update)FAILS无法安装gems http_parser.rb,eventmachine

在本地存储和安装ruby gems用于ruby项目

10 个必备而且非常有用的 Ruby on Rails 4 Gems

如何安装 Ruby 和 RubyGems

为 Web 开发提供的 10 个 Ruby on Rails Gems

乘客:无法加载此类文件 ruby​​gems/builder