【发布时间】:2020-08-27 09:37:26
【问题描述】:
这最初是一个关于特定 gem 安装问题的问题,但我经历了如此多的问题迭代,试图让这个应用程序在 Windows 10 上运行,我决定改变这个问题并写一份指南。希望这对将来遇到这些问题的其他人(或我自己)有用。
我正在运行 Windows 10 64 位机器。我已经尝试过 RubyInstaller 并为 Linux (WSL) 设置了 Windows 子系统,但遇到了各种安装问题、gem 依赖问题,并且直接模糊为任何知道什么问题的问题。
如何让 Ruby on Rails 以及随后在 Windows 10 上运行的 Locomotive CMS?
注意:我最初是按照 this tutorial 使用 RubyInstaller 安装 Ruby。这显然工作正常(尽管在此过程中出现了一些小问题),但我最终在尝试gem install locomotivecms_wagon 时遇到了以下错误,我无法解决:
ERROR: Error installing locomotivecms_wagon:
ERROR: Failed to build gem native extension.
current directory: C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogumbo-1.5.0/ext/nokogumboc
C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/bin/ruby.exe -I C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/site_ruby/2.5.0 -r ./siteconf20200827-12272-1va06mr.rb extconf.rb
checking for xmlNewDoc() in -lxml2... yes
checking for nokogiri.h in C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.10/ext/nokogiri... yes
checking for nokogiri.h in C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.10/ext/nokogiri... yes
checking for gumbo_parse() in -lgumbo... no
checking for GumboErrorType with error.h... not found
checking for GumboInsertionMode with insertion_mode.h... not found
checking for GumboParser with parser.h... not found
checking for GumboStringBuffer with string_buffer.h... not found
checking for GumboTokenType with token_type.h... not found
creating Makefile
current directory: C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogumbo-1.5.0/ext/nokogumboc
make "DESTDIR=" clean
current directory: C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogumbo-1.5.0/ext/nokogumboc
make "DESTDIR="
generating nokogumboc-x64-mingw32.def
compiling attribute.c
compiling char_ref.c
compiling error.c
compiling nokogumbo.c
In file included from nokogumbo.c:31:
C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogiri-1.10.10/ext/nokogiri/nokogiri.h:13: warning: "_GNU_SOURCE" redefined
13 | #define _GNU_SOURCE
|
In file included from C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/include/ruby-2.5.0/ruby/ruby.h:24,
from C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/include/ruby-2.5.0/ruby.h:33,
from nokogumbo.c:21:
C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/include/ruby-2.5.0/x64-mingw32/ruby/config.h:18: note: this is the location of the previous definition
18 | #define _GNU_SOURCE 1
|
compiling parser.c
compiling string_buffer.c
compiling string_piece.c
compiling tag.c
compiling tokenizer.c
compiling utf8.c
compiling util.c
compiling vector.c
linking shared-object nokogumboc.so
C:/Dev/Dependencies/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: nokogumbo.o:nokogumbo.c:(.text+0x49b): undefined reference to 'Nokogiri_wrap_xml_document'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:259: nokogumboc.so] Error 1
make failed, exit code 2
Gem files will remain installed in C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/gems/nokogumbo-1.5.0 for inspection.
Results logged to C:/Dev/Dependencies/rubyinstaller-2.5.8-1-x64/lib/ruby/gems/2.5.0/extensions/x64-mingw32/2.5.0/nokogumbo-1.5.0/gem_make.out
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
【问题讨论】:
-
只是出于好奇。您的安装过程与此不同吗? gorails.com/setup/windows/10
-
是的,它完全不同。我实际上尝试了您首先链接到的那个 - 我认为在 Windows WSL 上运行 RoR 将是理想的,因为我将拥有一个真正的 Linux 环境。但是我在安装 gems 时遇到了麻烦。经常不得不使用“sudo”来安装我听说过的所有东西,这不是一个好主意。当我终于来安装 locomotivecms_wagon 时,由于 nokogiri 的版本而失败了。我不记得细节了,但我得出的(可能是不正确的)结论是它永远不会起作用,而是选择了RubyInstaller。
-
终于放弃了RubyInstaller。它在 Windows 7 环境中运行良好,但我无法在 Windows 10 下使用 locomotivecms_wagon 进行安装。我进行了 3 次完整的安装和卸载,每次都遇到不同的问题,但都与 Nokogiri 或 Nokogumbo 有关。那些 Noko 宝石不能很好地与其他人一起玩。
-
我设置了 Windows WSL。也进行了 2 次尝试,但最终到达那里并安装了 locomotivecms_wagon,它似乎正在工作。 Locomotive CMS Wagon 不能在高于 2.5.8 的 Ruby 上工作 - 因为存在依赖问题......你猜对了:Nokogumbo。
-
有趣。你和这个用户有同样的问题吗? github.com/rubys/nokogumbo/issues/146
标签: ruby windows nokogiri locomotivecms nokogumbo