I just installed ruby
and gem
on windows 10 x64, I checked that they were both installed. when I tried to install rails, it fails after a while.
see the link below for used commands
El Administrator: Windows PowerShell
PS C:\WINDOWS\system32> ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) (x64-mingw32]
PS C:\WINDOWS\system32> gem --version 2.6.14 PS
C:\WINDOWS\system32> gem install rails
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: CuRuby24-x64/lib/ruby/gems/2.4.0/gems/nio4r-2.2.0/ext/nio4r
C:/Ruby24-x64/bin/ruby.exe -r asiteconf20180211-14528-1um1rd2.rb extconf.rb
current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nio4r-2.2.0/ext/nio4r
make "DESTDIR=" clean
'make' is not recognized as an internal or external command,
operable program or batch file.
current directory: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nio4r-2.2.0/ext/nio4r
make "DESTDIR="
'make' is not recognized as an internal or external command,
operable program or batch file.
make failed, exit code 1
Gem files will remain installed in C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nio4r-2.2.0 for inspection.
Results logged to C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/nio4r-2.2.0/gem_make.out
PS C:\WINDOWS\system32>
I fixed this issue by using wsl. The installation process is explained here . I also had to use this to enable wsl on windows 10 build 16299.192(settings > system > about). also after i installed everything I ran sudo apt-get install nodejs
and gem install rails
. After this, I could run the demo( wsl> rails new demo
, wsl> cd demo
, wsl> rails server
).
You need the build tools to build native extensions.
sudo apt-get update
sudo apt-get install build-essential
Credit: How do I fix an error with Ruby Gems Installer on WSL?
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.