无法在 Windows 10 上安装/使用 LocomotiveCMS Wagon
Can't Install / Use LocomotiveCMS Wagon on Windows 10
这最初是一个关于特定 gem 安装问题的问题,但我经历了如此多的问题迭代,试图让这个应用程序在 Windows 10 上运行,所以我决定改变这个问题并且写一份指南。希望这对将来遇到这些问题的其他人(或我自己)有用。
我是运行一台Windows10 64位机器。我已经尝试 RubyInstaller 并为 Linux (WSL) 设置 Windows 子系统,但遇到了各种安装问题、gem 依赖性问题,而且直接含糊不清谁知道什么问题。
如何在 Rails 上获得 Ruby,然后在 Windows 10 上获得机车 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...
我在这里发现了一个类似的 GitHub 问题:https://github.com/rubys/nokogumbo/issues/4。
他们提到了以下声明作为解决方案:
gem install nokogumbo -- --with-ldflags=-no-undefined
运行 这个命令然后 re-run bundle install
.
安装、卸载和重新安装 3 次后,我放弃了 RubyInstaller。 Ruby安装程序对我来说非常有用 运行ning Windows 7 - 我怀疑如果没有它,我是否能够获得一个工作的 Ruby 环境。它可能对 Windows 10 上的某些东西有用。我设置好了,但我无法安装 Locomotive CMS Wagon gem根据我的问题。
对我有用的是设置 WSL (Windows SubSystem for Linux) and installing Ruby on that. I followed the Go Rails tutorial in conjunction with these instructions。
我强烈推荐 updating the WSL Linux kernel (WSL 1 > WSL 2). I didn't do this the first time around and had various problems. This GitHub tutorial 帮助确定您是否安装了 WSL 1 或 2。
(我并不担心创建另一个用户,如 GitHub 教程中所述,因为我在第一次启动 Ubuntu 时被提示这样做。尽我所能告诉这是防止用户与 root 权限问题所需要的。我还没有遇到任何问题。)
当您开始安装 Ruby 时,不要安装 2.7.1。如果这样做,那么在您开始安装 locomotivecms_wagon 时,截至撰写本文时,您将 运行 遇到以下问题:
Bundler found conflicting requirements for the Ruby version:
In Gemfile:
Ruby
locomotivecms_steam was resolved to 1.5.0.rc0, which depends on
nokogiri (~> 1.8.2) was resolved to 1.8.5, which depends on
Ruby (>= 2.1.0)
locomotivecms_steam was resolved to 1.5.0.rc0, which depends on
nokogiri (~> 1.8.2) was resolved to 1.8.5, which depends on
Ruby (< 2.6, >= 2.2) x64-mingw32
据我所知,您只能在 Ruby < 2.6 或 >= 2.1.0 上 运行 机车 CMS。
我使用 rbenv 而不是 rvm。那是另一个讨论。
完成所有这些之后,我能够毫不费力地设置以下内容:
- 按照 these instructions 安装 Node.js。
- 按照 these instructions 安装 Yarn:
npm install -g yarn
- 按照 these instructions 安装 Image Magick:
sudo apt-get install imagemagick
- 按照 Locomotive CMS docs 安装机车 CMS:
gem install locomotivecms_wagon
一些注意事项:
- 我还没有在 WSL 上设置 Git。我担心它将如何处理通过 Ubuntu 所做的更改与通过 Windows 所做的更改。我将需要通过 Windows 进行一些更改 - 通过终端完成所有操作是不现实的。不确定那将如何进行。当我发现时,我可能会用更多信息更新这个答案。
- 我的所有文件都包含在 Dropbox 文件夹中。不确定我将在 Ubuntu 下创建/编辑它们是否会产生任何影响。
这最初是一个关于特定 gem 安装问题的问题,但我经历了如此多的问题迭代,试图让这个应用程序在 Windows 10 上运行,所以我决定改变这个问题并且写一份指南。希望这对将来遇到这些问题的其他人(或我自己)有用。
我是运行一台Windows10 64位机器。我已经尝试 RubyInstaller 并为 Linux (WSL) 设置 Windows 子系统,但遇到了各种安装问题、gem 依赖性问题,而且直接含糊不清谁知道什么问题。
如何在 Rails 上获得 Ruby,然后在 Windows 10 上获得机车 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...
我在这里发现了一个类似的 GitHub 问题:https://github.com/rubys/nokogumbo/issues/4。
他们提到了以下声明作为解决方案:
gem install nokogumbo -- --with-ldflags=-no-undefined
运行 这个命令然后 re-run bundle install
.
安装、卸载和重新安装 3 次后,我放弃了 RubyInstaller。 Ruby安装程序对我来说非常有用 运行ning Windows 7 - 我怀疑如果没有它,我是否能够获得一个工作的 Ruby 环境。它可能对 Windows 10 上的某些东西有用。我设置好了,但我无法安装 Locomotive CMS Wagon gem根据我的问题。
对我有用的是设置 WSL (Windows SubSystem for Linux) and installing Ruby on that. I followed the Go Rails tutorial in conjunction with these instructions。
我强烈推荐 updating the WSL Linux kernel (WSL 1 > WSL 2). I didn't do this the first time around and had various problems. This GitHub tutorial 帮助确定您是否安装了 WSL 1 或 2。
(我并不担心创建另一个用户,如 GitHub 教程中所述,因为我在第一次启动 Ubuntu 时被提示这样做。尽我所能告诉这是防止用户与 root 权限问题所需要的。我还没有遇到任何问题。)
当您开始安装 Ruby 时,不要安装 2.7.1。如果这样做,那么在您开始安装 locomotivecms_wagon 时,截至撰写本文时,您将 运行 遇到以下问题:
Bundler found conflicting requirements for the Ruby version:
In Gemfile:
Ruby
locomotivecms_steam was resolved to 1.5.0.rc0, which depends on
nokogiri (~> 1.8.2) was resolved to 1.8.5, which depends on
Ruby (>= 2.1.0)
locomotivecms_steam was resolved to 1.5.0.rc0, which depends on
nokogiri (~> 1.8.2) was resolved to 1.8.5, which depends on
Ruby (< 2.6, >= 2.2) x64-mingw32
据我所知,您只能在 Ruby < 2.6 或 >= 2.1.0 上 运行 机车 CMS。
我使用 rbenv 而不是 rvm。那是另一个讨论。
完成所有这些之后,我能够毫不费力地设置以下内容:
- 按照 these instructions 安装 Node.js。
- 按照 these instructions 安装 Yarn:
npm install -g yarn
- 按照 these instructions 安装 Image Magick:
sudo apt-get install imagemagick
- 按照 Locomotive CMS docs 安装机车 CMS:
gem install locomotivecms_wagon
一些注意事项:
- 我还没有在 WSL 上设置 Git。我担心它将如何处理通过 Ubuntu 所做的更改与通过 Windows 所做的更改。我将需要通过 Windows 进行一些更改 - 通过终端完成所有操作是不现实的。不确定那将如何进行。当我发现时,我可能会用更多信息更新这个答案。
- 我的所有文件都包含在 Dropbox 文件夹中。不确定我将在 Ubuntu 下创建/编辑它们是否会产生任何影响。