rails 5.0.0 when installing “nio4r” : Failed to build gem native extension

a 夏天 提交于 2019-11-30 13:45:32

I am facing the same issue while I was trying to upgrade my Rails to V5.0.0, I follow this instruction and it works perfectly. Read the section "Install the Ruby DevKit" here >> http://jekyll-windows.juthilo.com/1-ruby-and-devkit/

Solution for Fedora 64bit

sudo dnf install redhat-rpm-config

I came across this problem as i was setting up rails too. (looking for an alternative to php).

  • I realized that i had installed x86 ruby with x64 Devkit, so i first downloaded x64 ruby which i installed and uninstalled the x86 version. I made sure my path variables were well set.
  • Then i installed devkit using the instructions on this page http://rubyonwindowsguides.github.io/book/ch02-04.html
  • Finally i installed rails and it worked fine without the errors this time

Hope this helps

My son fixed this problem for me. The problem was that I installed first, Ruby and then the Rails installer. So I had to uninstall Ruby and reinstall with the Rails installer only.

I had a similar problem and running this command solved my issue.

bundle config build.nio4r --with-cflags="-std=c99"

Now you can successfully run bundle install afterwards.

Remove the Gemfile.lock and run bundle install command

To quote from your log output:

The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first.

On windows, you need to install the DevKit in order to be able to compile gems.

Had this same issue on Ubuntu 16.04. What I did to fix this :

Remove Gemfile.lock : sudo rm Gemfile.lock Installed Ruby-Dev:

sudo apt-add-repository ppa:brightbox/ruby-ng sudo apt-get update sudo apt-get install ruby2.4-dev

and the important step : REBOOT!

If you use Windows and installed ruby with RubyInstaller with version more or equal to 2.4, than you should not install DevKit from RubyInstaller website and only use 'msys64' which is installed after Ruby with RubyInstaller (make sure you type number 3 to install both msys and mingw). Delete devkit directory and its path from PATH environment variable, so when rubygems will try to install nio4r and call C compilers, it will call msys ones. Read here https://rubyinstaller.org/2017/05/25/rubyinstaller-2.4.1-1-released.html for more info about MSYS2 and DevKit in RubyInstaller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!