ERROR: Failed to build gem native extension on Windows
Finally after much research I found the culprit was the RubyGems version incompatibility with native extension gems!!!
I had ruby gems ver 2.4.1 but seems like >2.4.0 has these issues
gem update --system 2.3.0
did the trick for me :)
Refer: https://github.com/rubygems/rubygems/issues/977
ruby install rails with Error ---Failed to build gem native extension.(Windows platform)
Just back from a vacation, and this problem has been solved during the holiday. Forgive me for not remembering to close this issue until now.XD
With the help of Josien's comments, the problem has narrowed down to gem install websocket-driver
failed. It's easier to find this problem on stackoverflow-Error when trying to install gem websocket-driver-0.7.3
Finally, I solved this problem just by typing ridk install
(to make MSYS2 work for ruby3.0.1)——I have installed MSYS2 and make it work under ruby2.7.4, but if you want to make it work for ruby3.0.1 samely , you need to excute this command under ruby3.0.1.
After installed MSYS2 for ruby3.0.1, rails installed sucessfully.
C:\Users\Administrator>Uru ls
274p191 : ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x64-mingw32]
310p0 : ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
C:\Users\Administrator>ruby -v
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [x64-mingw-ucrt]
C:\Users\Administrator>ridk install
_____ _ _____ _ _ _ ___
| __ \ | | |_ _| | | | | | |__ \
| |__) | _| |__ _ _ | | _ __ ___| |_ __ _| | | ___ _ __ ) |
| _ / | | | '_ \| | | | | | | '_ \/ __| __/ _` | | |/ _ \ '__/ /
| | \ \ |_| | |_) | |_| |_| |_| | | \__ \ || (_| | | | __/ | / /_
|_| \_\__,_|_.__/ \__, |_____|_| |_|___/\__\__,_|_|_|\___|_||____|
__/ | _
|___/ _|_ _ __ | | o __ _| _ _
| (_) | |^| | | |(_|(_)\^/_>
1 - MSYS2 base installation
2 - MSYS2 system update (optional)
3 - MSYS2 and MINGW development toolchain
Which components shall be installed? If unsure press ENTER [1,3] 1,3
> sh -lc true
MSYS2 seems to be properly installed
Install MSYS2 and MINGW development toolchain ...
> pacman -S --needed --noconfirm autoconf autogen automake-wrapper diffutils file
...
...
...
Install MSYS2 and MINGW development toolchain succeeded
1 - MSYS2 base installation
2 - MSYS2 system update (optional)
3 - MSYS2 and MINGW development toolchain
Which components shall be installed? If unsure press ENTER []
C:\Users\Administrator>gem install rails
Building native extensions. This could take a while...
Successfully installed websocket-driver-0.7.5
Building native extensions. This could take a while...
Successfully installed nio4r-2.5.8
Successfully installed actioncable-7.0.2
Successfully installed rails-7.0.2
Parsing documentation for websocket-driver-0.7.5
Installing ri documentation for websocket-driver-0.7.5
Parsing documentation for nio4r-2.5.8
Installing ri documentation for nio4r-2.5.8
Parsing documentation for actioncable-7.0.2
Installing ri documentation for actioncable-7.0.2
Parsing documentation for rails-7.0.2
Installing ri documentation for rails-7.0.2
Done installing documentation for websocket-driver, nio4r, actioncable, rails after 2 seconds
4 gems installed
C:\Users\Administrator>rails -v
Rails 7.0.2
gem install json --platform=ruby failed windows 7 64 bit
Check are you getting the proper ruby version in the file after doing ruby dk.rb init, if not specify the proper ruby version as in the program files, then try to run ruby dk.rb install, once this is done devkit is installed and you can install the required gem.
Error installing calabash-android on Windows
This issue:
Error installing calabash-android:
ERROR: Failed to build gem native extension.
Occurs due to incompatibility rubygem version with native extension.
following command will fix this issue:
gem update --system 2.3.0
Refer:
1) https://github.com/rubygems/rubygems/issues/977
2) ERROR: Failed to build gem native extension on Windows
Related Topics
What's the Best Way to Talk to a Database While Using Sinatra
Is There a Literal Notation for an Array of Symbols
Access Instance Variable from Outside the Class
Convert an Array of Integers into an Array of Strings in Ruby
Nested Object Creation with JSON in Rails
How to Set Up Cascade Deleting in Rails
Skip Over Iteration in Enumerable#Collect
Difference Between Plugins and Ruby Gems
Getting Only New Mail from an Imap Server
Count Number of Days Between Two Dates
How to Return Something Early from a Block
How to Check If a Class Is Defined
Nokogiri: Select Content Between Element a and B
Micropost's Comments on Users Page (Ruby on Rails)
How to Break from Nested Loops in Ruby