开发者

Getting crazy over Rails 3, RVM, gems

EDIT: Please note that this question is OUTDATED; RVM got way easier to use now. So this problem/solution should no longer apply.

.

This question is really hard for me to describe, so any improvements on it would be nice.

I am currently on Ubuntu 10.4, I have installed RVM (probably as root, that could be my mistake)

I did what this guide told me to do: http://rubyonrails.dreamwidth.org/1713.html and from my point of view it worked.

I was able to create a project on Rails 3 painlessly, yay

But when starting the server or console i got: Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the开发者_运维知识库 gem sources.

I tryed: sudo gem install sqlite3-ruby All failed with the output:

/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such file to load -- mkmf (LoadError)

Even after lots of dev packages installed over Ubuntu, still failed. So i ran: sudo gem1.9 install sqlite3-ruby and succeeded!

Now, I try running my server but still get the same error! My guess is that i must set gem = gem1.9, but I have no idea how =(

UPDATE:

fps ~ $ ls /var/lib/gems
# 1.8  1.9  1.9.0
fps ~ $ ls /var/lib/gems/1.8/gems
# actionmailer-2.3.5  activeresource-2.3.5  builder-2.1.2  rake-0.8.7
# actionpack-2.3.5    activesupport-2.3.5   rack-1.0.1     rubygems-update-1.3.7
# activerecord-2.3.5  activesupport-3.0.0   rails-2.3.5
fps ~ $ ls /var/lib/gems/1.9/gems
# ls: cannot access /var/lib/gems/1.9/gems: No such file or directory
fps ~ $ ls /var/lib/gems/1.9.0/gems
# sqlite3-ruby-1.3.1

UPDATE2

Have followed @"The MYYN" and @"ennuikiller" steps, here are the results:

fps ~ $ sudo rvm gem install sqlite3-ruby
[sudo] password for fps: 

info: ruby-1.8.7-p302: ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux] 
#...
1 gem installed
#...
info: ruby-1.9.2-head: ruby 1.9.2p0 (2010-09-15 revision 29252) [i686-linux] 

Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.3.1

and watched railscasts/201 Bundler

fps ~/Aptana Studio 3 Workspace/dum $ bundle install
Fetching source index for http://rubygems.org/
#...
Using railties (3.0.0) 
Using rails (3.0.0) 
Installing sqlite3-ruby (1.3.1) with native extensions /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensio
ns': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

/usr/bin/ruby1.8 extconf.rb 
extconf.rb:3:in `require': no such file to load -- mkmf (LoadError)
        from extconf.rb:3

Got the same error again.. If there is a way to make rails 3 work sudo remove this rvm, and bring my ruby back to 1.8.7, i am considering.


I guess my problem was too specific, the solution I found is documented on my Blog: http://fabianosoriani.wordpress.com/2010/09/21/installing-rails-3-0-0-on-ubuntu-10-4


mkmf.rb is part of the ruby1.8-dev package , so try installing it.

sudo apt-get install ruby1.8-dev


do a gem env and look at your GEM PATHS to see where rails/ruby expects to find them.

Also if you are using rvm then you need to install your gems through rvm:

rvm gem install <gem>

to insure you are updating the appropriate gem path

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜