在Ubuntu上安装的Rails无法加载mkmf?

时间:2013-02-19 23:40:42

标签: ruby-on-rails ruby ubuntu install

我正在尝试在Ubuntu上安装Rails:

sudo gem install rails

但我遇到了麻烦:

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/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
  from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
  from extconf.rb:1:in `<main>'


Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

有什么问题?

2 个答案:

答案 0 :(得分:12)

丹尼尔在评论中说,试着执行sudo apt-get install ruby-dev

答案 1 :(得分:0)

试试吧,我已经在Ubuntu 12.4上成功安装了(您可以在安装过程中选择版本,根据您的要求....)

  1. sudo apt-get update
  2. sudo apt-get install build-essential git-core curl libmysqlclient18 nodejs

  3. sudo bash -s stable&lt; &lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) umask g + w

  4. source /etc/profile.d/rvm.sh

  5. sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion

  6. sudo chown -R [user]:[user] / usr / local / rvm 示例:sudo chown -R rohitporwal:rohitporwal / usr / local / rvm

  7. source / usr / local / rvm / scripts / rvm

  8. rvm install 1.9.2

  9. sudo gem install rails