简体   繁体   English

安装 Rails 6.0.0 时出错:无法构建 gem 原生扩展

[英]Error installing Rails 6.0.0: Failed to build gem native extension

I am attempting to install Ruby and Rails for the first time and cannot get Rails v6 to install properly.我第一次尝试安装 Ruby 和 Rails,但无法正确安装 Rails v6。 My machine is Windows 10. I have Ruby 2.6.5p114 and RubyGems 3.0.6.我的机器是 Windows 10。我有 Ruby 2.6.5p114 和 RubyGems 3.0.6。 I am attempting to install rails 6.0.0.我正在尝试安装 rails 6.0.0。 My terminal shows the installation going smoothly until it tries to build native extensions.我的终端显示安装进展顺利,直到它尝试构建本机扩展。 I wonder if I am trying to install the incorrect versions of Ruby, Rails, or RubyGems?我想知道我是否尝试安装不正确版本的 Ruby、Rails 或 RubyGems? Here is the full command prompt with error at the bottom -这是完整的命令提示符,底部有错误 -

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

The file under 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 contains the following - 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

I tried updating Gem like other posts have suggested with no luck.我尝试像其他帖子建议的那样更新 Gem,但没有成功。 Any insight into my issue would be greatly appreciated!对我的问题的任何见解将不胜感激!

UPDATE: Rails v4.0.0 installs fine.更新:Rails v4.0.0 安装良好。 v5.0.0 provided the same error. v5.0.0 提供了相同的错误。 Will I have issues running Ruby 2.6.5p114 and Gems 3.0.6 and working with Rails 4.0.0?我在运行 Ruby 2.6.5p114 和 Gems 3.0.6 以及使用 Rails 4.0.0 时会遇到问题吗? What things will I not be able to do with this lower version?使用此较低版本我将无法做哪些事情? I'd prefer to not settle with v4, I'd rather have v6.我宁愿不满足于 v4,我宁愿拥有 v6。

UPDATE 2: Rails v4.2.11.1 installs fine as well.更新 2:Rails v4.2.11.1 也可以正常安装。 It was updated most recently in March 2019, even though v5 was released in June 2016. I will stick with v4.2.11.1 for now until otherwise helped.它最近一次更新是在 2019 年 3 月,尽管 v5 是在 2016 年 6 月发布的。我现在会坚持使用 v4.2.11.1,直到有其他帮助。

I found this thread on the issue board for the websockets gem that's erroring: https://github.com/faye/websocket-driver-ruby/issues/35我在出错的 websockets gem 的问题板上找到了这个线程: https://github.com/faye/websocket-driver-ruby/issues/35

I concur that you should try and manually install the websockets-driver gem and see if the rest of the bundle will then install.我同意您应该尝试手动安装 websockets-driver gem,然后查看捆绑包的 rest 是否会安装。

Another thing you can do if this version of this gem just refuses to work on your system, is you can go into the gemfile for this project and manually specify an earlier version of the gem.如果此 gem 的此版本拒绝在您的系统上运行,您可以做的另一件事是,您可以将 go 放入此项目的 gemfile 并手动指定早期版本的 gem。 There's a good chance that you can still work with an older version of it in the mean time, and that way you could still use rails 6.与此同时,您很有可能仍然可以使用它的旧版本,这样您仍然可以使用 rails 6。

I had the same problem.我有同样的问题。 I could install with the following command:我可以使用以下命令安装:

sudo gem install rails --version 4.0

But I got version 4.0但我得到了 4.0 版

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 安装rails时出错错误:无法构建gem本机扩展 - Error installing rails ERROR: Failed to build gem native extension Rails:安装 rmagick 时出错 - 错误:无法构建 gem 本机扩展 - Rails: Error installing rmagick - ERROR: Failed to build gem native extension 在Rails上安装ruby时出错,无法构建gem本机扩展 - Error while installing ruby on rails,Failed to build gem native extension 安装 fcgi 时出现 Rails 错误:无法构建 gem 原生扩展 - Rails error while installing fcgi: Failed to build gem native extension 安装 rails 时出错,无法构建 gem 本机扩展 - Error installing rails, failed to build gem native extension 在Ubuntu 16.04上安装Rails时出错,无法构建gem本机扩展 - error installing rails on ubuntu 16.04 failed to build gem native extension 错误:安装Rails时无法构建gem本机扩展 - ERROR: Failed to build gem native extension when installing rails 安装 Ruby on Rails 时出错:“无法构建 gem 本机扩展” - Error when installing Ruby on Rails: “Failed to build gem native extension” "<i>&quot;ERROR: Failed to build gem native extension.&quot;<\/i> “错误:无法构建 gem 原生扩展。”<\/b> <i>while installing Rails<\/i>在安装 Rails 时<\/b>" - "ERROR: Failed to build gem native extension." while installing Rails 无法构建Gem扩展错误,安装滑轨 - Failed to Build Gem Extension Error Installing rails
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM