安装 Rails 6.0.0 时出错:无法构建 gem 本机扩展



我第一次尝试安装 Ruby 和 Rails,但无法正确安装 Rails v6。我的机器是Windows 10。我有Ruby 2.6.5p114和RubyGems 3.0.6。我正在尝试安装导轨 6.0.0。我的终端显示安装进展顺利,直到它尝试构建本机扩展。我想知道我是否正在尝试安装不正确版本的Ruby,Rails或RubyGems?这是底部出现错误的完整命令提示符 -

d:>gem install rails -v 6.0.0
Fetching concurrent-ruby-1.1.5.gem
Fetching i18n-1.7.0.gem
Fetching thread_safe-0.3.6.gem
Fetching tzinfo-1.2.5.gem
Fetching zeitwerk-2.2.0.gem
Fetching activesupport-6.0.0.gem
Fetching rack-2.0.7.gem
Fetching rack-test-1.1.0.gem
Fetching mini_portile2-2.4.0.gem
Fetching nokogiri-1.10.4-x64-mingw32.gem
Fetching crass-1.0.4.gem
Fetching loofah-2.3.0.gem
Fetching rails-html-sanitizer-1.3.0.gem
Fetching rails-dom-testing-2.0.3.gem
Fetching builder-3.2.3.gem
Fetching erubi-1.9.0.gem
Fetching actionview-6.0.0.gem
Fetching actionpack-6.0.0.gem
Fetching activemodel-6.0.0.gem
Fetching activerecord-6.0.0.gem
Fetching globalid-0.4.2.gem
Fetching activejob-6.0.0.gem
Fetching mini_mime-1.0.2.gem
Fetching mail-2.7.1.gem
Fetching actionmailer-6.0.0.gem
Fetching nio4r-2.5.2.gem
Fetching websocket-extensions-0.1.4.gem
Fetching websocket-driver-0.7.1.gem
Fetching actioncable-6.0.0.gem
Fetching mimemagic-0.3.3.gem
Fetching marcel-0.3.3.gem
Fetching activestorage-6.0.0.gem
Fetching rails-6.0.0.gem
Fetching actionmailbox-6.0.0.gem
Fetching actiontext-6.0.0.gem
Fetching thor-0.20.3.gem
Fetching method_source-0.9.2.gem
Fetching railties-6.0.0.gem
Fetching sprockets-4.0.0.gem
Fetching sprockets-rails-3.2.1.gem
Successfully installed concurrent-ruby-1.1.5
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
Successfully installed i18n-1.7.0
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.5
Successfully installed zeitwerk-2.2.0
Successfully installed activesupport-6.0.0
Successfully installed rack-2.0.7
Successfully installed rack-test-1.1.0
Successfully installed mini_portile2-2.4.0
Nokogiri is built with the packaged libraries: libxml2-2.9.9, libxslt-1.1.33, zlib-1.2.11, libiconv-1.15.
Successfully installed nokogiri-1.10.4-x64-mingw32
Successfully installed crass-1.0.4
Successfully installed loofah-2.3.0
Successfully installed rails-html-sanitizer-1.3.0
Successfully installed rails-dom-testing-2.0.3
Successfully installed builder-3.2.3
Successfully installed erubi-1.9.0
Successfully installed actionview-6.0.0
Successfully installed actionpack-6.0.0
Successfully installed activemodel-6.0.0
Successfully installed activerecord-6.0.0
Successfully installed globalid-0.4.2
Successfully installed activejob-6.0.0
Successfully installed mini_mime-1.0.2
Successfully installed mail-2.7.1
Successfully installed actionmailer-6.0.0
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.2
Successfully installed websocket-extensions-0.1.4
Building native extensions. This could take a while...
ERROR:  Error installing rails:
ERROR: Failed to build gem native extension.
current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
D:/Program Files/Ruby26-x64/bin/ruby.exe -I D:/Program Files/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20191012-5104-nq808.rb extconf.rb
creating Makefile
current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR=" clean
Makefile:269: *** multiple target patterns.  Stop.
current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR="
Makefile:269: *** multiple target patterns.  Stop.
make failed, exit code 2
Gem files will remain installed in D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1 for inspection.
Results logged to D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/websocket-driver-0.7.1/gem_make.out

D:\Program Files\Ruby26-x64\lib\ruby\gems\2.6.0\extensions\x64-mingw32\2.6.0\websocket-driver-0.7.1\gem_make.out 下的文件包含以下内容 -

current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
D:/Program Files/Ruby26-x64/bin/ruby.exe -I D:/Program Files/Ruby26-x64/lib/ruby/2.6.0 -r ./siteconf20191012-2920-1j4dz9l.rb extconf.rb
creating Makefile
current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR=" clean
Makefile:269: *** multiple target patterns.  Stop.
current directory: D:/Program Files/Ruby26-x64/lib/ruby/gems/2.6.0/gems/websocket-driver-0.7.1/ext/websocket-driver
make "DESTDIR="
Makefile:269: *** multiple target patterns.  Stop.
make failed, exit code 2

我尝试像其他帖子建议的那样更新 Gem,但没有运气。对我的问题的任何见解将不胜感激!

更新:Rails v4.0.0 安装正常。 v5.0.0 提供了相同的错误。我在运行 Ruby 2.6.5p114 和 Gems 3.0.6 以及使用 Rails 4.0.0 时会遇到问题吗?我不能用这个较低的版本做什么?我宁愿不满足于 v4,我宁愿使用 v6。

更新2:Rails v4.2.11.1安装也很好。它最近一次更新是在 2019 年 3 月,尽管 v5 是在 2016 年 6 月发布的。我现在将坚持使用 v4.2.11.1,直到其他帮助。

我在 websockets gem 的问题板上发现了这个线程,它出错了:https://github.com/faye/websocket-driver-ruby/issues/35

我同意您应该尝试手动安装 websockets-driver gem,看看捆绑包的其余部分是否会安装。

如果此版本的 gem 拒绝在您的系统上工作,您可以做的另一件事是您可以进入此项目的 gemfile 并手动指定早期版本的 Gem。同时,您很有可能仍然可以使用它的旧版本,这样您仍然可以使用 rails 6。

我遇到了同样的问题。 我可以使用以下命令进行安装:

sudo gem install rails --version 4.0

但我得到了 4.0 版

相关内容

  • 没有找到相关文章

最新更新