这最初是一个关于特定gem安装问题的问题,但是我经历了很多次迭代,试图让这个应用程序在Windows 10上工作,所以我决定修改这个问题并编写一份指南。希望这对将来经历这些问题的任何人(或我自己)都有帮助。
我正在运行一台Windows 10 64位机器。我尝试过RubyInstaller,并设置了Windows (WSL),并遇到了各种安装问题、创业板依赖问题,而且与任何知道问题的人一样,我都很模糊。
如何使Rails以及随后在Windows 10上运行的机车CMS?
注意:我最初跟随本教程安装了RubyInstaller。这显然很好(虽然在此过程中遇到了一些小问题),但我最终在尝试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...发布于 2020-08-30 09:24:18
在3次安装、卸载和重新安装之后,我放弃了RubyInstaller。RubyInstaller为我运行Windows7提供了很好的支持--我怀疑没有它我还能得到一个正常工作的Ruby环境。而且它可能在Windows 10上也起作用了。我已经设置好了,但是我不能让机车CMS货车创业板按照我问题中的问题安装。
对我起作用的是设置WSL ( SubSystem for Linux)并在上面安装Ruby。我和Go Rails教程一起跟踪这些指示。
我强烈推荐更新WSL Linux内核 (WSL 1> WSL 2)。我第一次没有这样做,有各种各样的问题。本GitHub教程帮助识别您是否安装了WSL 1或2。
(我不担心像GitHub教程中描述的那样创建另一个用户,因为我第一次启动Ubuntu时就被提示这样做了。据我所知,这是防止用户与根权限问题的必要条件。我还没有遇到任何问题。)
当您安装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。那是另一个讨论。
在我完成了所有的工作之后,我可以在没有太多麻烦的情况下建立以下内容:
npm install -g yarn安装纱线sudo apt-get install imagemagick安装图像Magickgem install locomotivecms_wagon安装机车CMS几个注意事项:
发布于 2020-08-28 20:13:14
我在这里发现了一个类似的GitHub问题:https://github.com/rubys/nokogumbo/issues/4。
他们提到以下声明作为解决办法:
gem install nokogumbo -- --with-ldflags=-no-undefined运行此命令,然后重新运行bundle install。
https://stackoverflow.com/questions/63613201
复制相似问题