0

我第一次尝试安装 Ruby 和 Rails,但无法正确安装 Rails v6。我的机器是 Windows 10。我有 Ruby 2.6.5p114 和 RubyGems 3.0.6。我正在尝试安装 rails 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,直到有其他帮助。

4

2 回答 2

0

我在错误的 websockets gem 的问题板上找到了这个线程:https ://github.com/faye/websocket-driver-ruby/issues/35

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

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

于 2019-10-12T23:00:22.883 回答
0

我有同样的问题。我可以使用以下命令安装:

sudo gem install rails --version 4.0

但我得到了 4.0 版

于 2020-12-15T15:57:20.083 回答