How to use gem to install Rails on Ubuntu

后端 未结 4 1228
一向
一向 2020-11-30 21:06

The error message:

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
  ERROR: Failed to build gem native extension.

           


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 21:50

    You get this error because the development dependencies for Ruby are missing.

    I suggest that you install and use RVM to solve this, check the official and updated instructions here https://rvm.io/rvm/install

    At the time when I answer this question I followed these steps:

    gpg --keyserver hkp://keys.gnupg.net --recv-keys
    409B6B1796C275462A1703113804BB82D39DC0E3
    
    \curl -sSL https://get.rvm.io | bash
    

    If you get this warning

      * WARNING: You have '~/.profile' file, you might want to load it,
        to do that add the following line to '/home/mao/.bash_profile':
    
      source ~/.profile
    

    execute this command:

    echo source ~/.profile >> ~/.bash_profile
    

    Then, reload/apply the bash_profile that you just updated by executing this:

    source ~/.bash_profile
    

    Finally run this to install the requirements:

    rvm requirements
    

    This should work for any Linux distribution like Ubuntu, Fedora, Debian, Redhat, Slackware.

提交回复
热议问题