In the interest of those who may read this from Google etc, the OP answered the question in his own response. To explain why the error occurred, we’ll give a brief a synopsis…
*Failed to build native extensions* errors are not a problem with Ruby but the OS. The problem is that the gem you’re trying to install requires certain files to be present on the system in order to build the gem.
The error ALWAYS cites **extconf.rb** in the /ext folder of the gem as the problem → this file is used to build the native dependencies on the OS level.
A good example of this is the MYSQL2 gem (https://medium.com/ruby-on-rails-web-application-development/installing-the-mysql2-rubyonrails-gem-on-windows-7-8-a028f44d87f3). To install MYSQL2, you need to have the MySQL C-Connector plugin installed.
In your situation, it looks like you’re trying to install the nio4r gem, which apparently requires particular build tools to make it work. Most comments suggest using Devkit, which is not advisable with RubyInstaller 2.4.x.
Since the new RubyInstaller 2.4.x relies on MSYS2, you’ll be best using the following commands:
pacman -S base-devel mingw-w64-x86_64-toolchain
ridk exec gem install nio4rWe got it working from a test we made ↓

