简体   繁体   中英

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. My machine is Windows 10. I have Ruby 2.6.5p114 and RubyGems 3.0.6. I am attempting to install 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? 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 -

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. Any insight into my issue would be greatly appreciated!

UPDATE: Rails v4.0.0 installs fine. v5.0.0 provided the same error. Will I have issues running Ruby 2.6.5p114 and Gems 3.0.6 and working with 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.

UPDATE 2: Rails v4.2.11.1 installs fine as well. 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.

I found this thread on the issue board for the websockets gem that's erroring: 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.

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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM