Error when installing Ruby on Rails: “Failed to build gem native extension”

后端 未结 10 1657
太阳男子
太阳男子 2020-12-28 13:29

I\'m running Crunchbang 11 (Debian-based).

I\'m trying to install Ruby on Rails, like this:

gem install rails --version 4.0.0

I ge

相关标签:
10条回答
  • 2020-12-28 14:02

    Got the same issue when installing rails with the command "gem install rails -v 5.1.2" on windows7, solved after installing "MSYS2 and MINGW development toolchain" (command ridk install then option 3)..It took a while to finish the installation and then i installed rails without any problem

    0 讨论(0)
  • 2020-12-28 14:02

    Try

    sudo gem install rails --version 2.0

    to install libraries.

    0 讨论(0)
  • 2020-12-28 14:05

    On Fedora 30, I ran into this problem "Failed to build gem native extension". The log error was "gcc: fatal error: cannot read spec file ‘/usr/lib/rpm/redhat/redhat-hardened-cc1’: No such file or directory". The solution was found here.

    If you installed all the above, but the extensions would still not compile, you are probably running a Fedora image that misses redhat-rpm-config package. In that case gcc compiler would complain about one of the following:
    
    gcc: error: conftest.c: No such file or directory
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    To solve this, simply run sudo dnf install redhat-rpm-config.
    
    0 讨论(0)
  • 2020-12-28 14:09

    i'm running elementary os 5 and what i do is.

    sudo gem update --system
    

    and then try again.

    sudo gem install rails
    
    0 讨论(0)
提交回复
热议问题