开发者

Error ('The program 'rails' is currently not installed.') creating rails3 application using RVM

I'm on Ubuntu 11 Tring to install rails 3.1 It seems like I install rails but then I can't use it. I want to use rvm to install and use rails and I do not want to go the sudo apt-get route.

Thanks!

durrantm@castleLinux2011:~$ rvm list rubies

rvm rubies

   ruby-1.9.2-p290 [ x86_64 ]

durrantm@castleLinux2011:~$ rvm use --create 1.9.2@rails3
Using /home/durrantm/.rvm/gems/ruby-1.9.2-p290 with gemset rails3
durrantm@castleLinux2011:~$ rvm list rubies

rvm rubies

=> ruby-1.9.2-p290 [ x86_64 ]

durrantm@castleLinux2011:~$ gem install rails
    ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
    ERROR:  While executing gem ... (NameError)
        uninitialized constant Gem::Commands::InstallCommand
    durrantm@castleLinux2011:~$ sudo gem install rails
    Successfully installed rails-3.1.0
    1 gem installed
    Installing ri documentation for rails-3.1.0...
    file 'lib' not found
    Installing RDoc documentation for rails-3.1.0...
    file 'lib' not found
    durrantm@castleLinux2011:~$ rails
    The program 'rails' is currently not installed.  You can install it by typing:
    sudo apt-get install rails
    durrantm@castleLinux2011:~$ 

btw

durrantm@castleLinux2011:~$ gem install rails
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
durrantm@castleLinux2011:~$ 

doesn't work either and I have danced around the zlib issue for about an hour.

Also:

rvm gemset install rails
installing rails ...
ERROR: Error running 'GEM_HOME='/home/durrantm/.rvm/gems/ruby-1.9.2-p290@rails3' GEM_PATH='/home/durrantm/.rvm/gems/ruby-1.9.2-p290@rails3'  gem install rails    ', please read /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log
rails  failed to install ( output logged to: /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log )
durrantm@castleLinux2011:~$ tail -20 /home/durrantm/.rvm/log/ruby-1.9.2-p290/gem.install.log
[2011-09-13 09:17:57] GEM_HOME='/home/durrantm/.rvm/gems/ruby-1.9.2-p290@rails3' GEM_PATH='/home/durrantm/.rvm/gems/ruby-1.9.2-p290@rails3'  gem install rails    
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized consta开发者_如何学编程nt Gem::Commands::InstallCommand
durrantm@castleLinux2011:~$ 


no no, no rvmsudo.

rvm pkg install zlib && rvm install 1.9.2 (so it builds against that zlib that rvm installed) && rvm --create use 1.9.2@rails31 (to create a rails31 gemset and use it all on one go)

NOTE: use rvm install 1.9.2 if you used that to install originally. the -p290 shows up because it is a result of the fact that the ruby project has 290 as the official release and rvm picks up on that. This way with 1.9.2 and not 1.9.2-p290 when 1.9.2 series is jumped, rvm will pick up on that and install that instead. Otherwise if you originally did 'rvm install 1.9.2-p290' then do that instead.

As for the rails command. If you executed the above commands then you have been moved into the right rvm controlled ruby and gemset. If not then execute that command now (rvm --create use 1.9.2@rails31)

NOW you can execute gem install rails -v='3.1.0' (I added the version just in case rails changes before you see this)

This will install the rails gem and its deps into Ruby 1.9.2-p290's rails31 gemset. Now you can execute rails new test_app to test it. (I usually mkdir -p $HOME/tmp && cd $HOME/tmp && rails new test_app)

This should eliminate your problems.


You need to reinstall ruby. Follow the instructions in http://beginrescueend.com/packages/zlib/.

You might get the same problem with readline or openSSL, check the rvm website as they provide some workarounds for those libraries too.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜