Newbie to Ruby, and just started rails journey.
Have searched stackoverflow but many these questions came too long ago. My English is not good, please bear with my description. Here's my situation, hope I make myself clearly.
I'm on windows. And when I took ruby lessons online I had installed an older envir-- ruby2.7.4 with rails 7.0.1.
Yesterday I want to finish a new project with a newer ruby envir-- so i installed ruby3.1.0, but when I tried to install rails for this new Ruby verison, the ERROR occurred.
here is my envir:
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>gem -v
3.3.6
C:\Users\Administrator>d:
D:\>cd RubyDevkit
D:\RubyDevkit>ruby dk.rb install
[INFO] Skipping existing gem override for 'D:/Ruby27-x64'
[WARN] Skipping existing DevKit helper library for 'D:/Ruby27-x64'
[INFO] Skipping existing gem override for 'D:/Ruby31-x64'
[WARN] Skipping existing DevKit helper library for 'D:/Ruby31-x64'
D:\RubyDevkit>
as you can see, my current ruby version is 3.1.0 and I think I have installed Devkit for both my Rubies successfully.
and I have intalled MSYS2 as well (although I dont know why ruby need it, but I have met another ERROR which remind me to install MSYS and add it to PATH)

I think I have done everything correctly before I met this ERROR:
C:\Users\Administrator>gem install rails
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
D:/Ruby31-x64/bin/ruby.exe -I D:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220128-11340-9w9ez5.rb extconf.rb
creating Makefile
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\= clean
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\=
make failedNo such file or directory - make
Gem files will remain installed in D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5 for inspection.
Results logged to D:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/websocket-driver-0.7.5/gem_make.out
There is no exceptions when I installed rails for ruby2.7.4(the same command just finished with no error or warning).
I cant find any similar situation online. Anyone could help?
-------------------01/29-----------------divide----------------------------
thank for comments, really thought-provking. Following some plans(Although failed)
i tried to install gem websocket-driver separately, got the same error:
C:\Users\Administrator>gem install websocket-driver:0.7.5
Building native extensions. This could take a while...
ERROR: Error installing websocket-driver:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
D:/Ruby31-x64/bin/ruby.exe -I D:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220129-3864-wqfhn2.rb extconf.rb
creating Makefile
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\= clean
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\=
make failedNo such file or directory - make
Gem files will remain installed in D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5 for inspection.
Results logged to D:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/websocket-driver-0.7.5/gem_make.out
(delete this gem from root directory and reInstall got the same result as well)
Then I tired got this gem form bundler.rubygems.org, and install it locally. Got the same error:
C:\Users\Administrator>d:
D:\>cd rubyDownloads
D:\rubyDownloads>gem install websocket-driver-0.7.5.gem --local
Building native extensions. This could take a while...
ERROR: Error installing websocket-driver-0.7.5.gem:
ERROR: Failed to build gem native extension.
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
D:/Ruby31-x64/bin/ruby.exe -I D:/Ruby31-x64/lib/ruby/site_ruby/3.1.0 -r ./siteconf20220129-5896-885p1m.rb extconf.rb
creating Makefile
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\= clean
current directory: D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5/ext/websocket-driver
make DESTDIR\=
make failedNo such file or directory - make
Gem files will remain installed in D:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/websocket-driver-0.7.5 for inspection.
Results logged to D:/Ruby31-x64/lib/ruby/gems/3.1.0/extensions/x64-mingw-ucrt/3.1.0/websocket-driver-0.7.5/gem_make.out
Now the problem becomes: the gem websocket-driver and Any other gem that rely on it couldn't install successfully, and the ERROR is as shown above.