在Rails上安装Ruby时出错

时间:2013-11-06 14:38:13

标签: ruby-on-rails ruby gem

我正在尝试在我的本地计算机上安装Ruby on Rails用于开发目的,但我遇到了一个错误。我不能说,但似乎它可能是一个宝石错误。虽然,这是我第一次尝试使用Ruby,Gem和Rails这三个,所以我不确定。

运行命令“sudo gem install rails -V”这些是在命中错误后打印的最后几行:

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

    /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)  
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:13:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/atomic-1.1.14 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/atomic-1.1.14/ext/gem_make.out

安装的Ruby版本是:

ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

gem的版本是:

1.8.23

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

来自atomic gem README

As of 1.1.0, JDK8 is required to build the atomic gem, since it attempts to use the new atomic

请安装Java,然后重新运行gem install过程。

答案 2 :(得分:1)

你有什么Linux?

在Mint,我做了:

sudo apt-get install git
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install git-core
source ~/.rvm/scripts/rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm autolibs enable
rvm reload
rvm requirements
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
rvm install ruby-2.0
curl -L https://get.rvm.io | bash -s stable --rails

它工作正常。这将(当前)安装Ruby 2.0和rails 4.0。