开发者

The program 'rails' is currently not installed?

I've installed Ruby (1.8.7 via apt-get) and I installed Rails (2.3.2 via rubygems) but when I type 'rails newapp', I get this error:

The program 'rails' is currently not installed. You can install it by typing: sudo apt-get install 开发者_如何学Gorails
rails: command not found

When I run 'gem list' it shows rails and all of it's dependencies. Any idea what might have gone wrong?


rubygems' binary directories are not automatically included in the PATH. Also, you may try asking any Debian-related questions on Debian Q&A.


Using debian ruby packages is going to be misery, for more reasons than just the path issue you currently have. I recommend using rvm instead. rvm allows you to easily install new versions of ruby or even bounce back and forth between multiple installed versions (even jruby) and it will always fix your path appropriately so everything you need is in your path.

  1. Remove all debian ruby packages
  2. Install and configure rvm
  3. rvm install ruby-1.8.7


Nick's answer works for me under Ubuntu 10.10 (thanks, I was desperate).

sudo apt-get remove rubygems wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz tar xzvf rubygems-1.3.7.tgz cd rubygems-1.3.7/ sudo ruby setup.rb sudo ln -s /usr/bin/gem1.8 /usr/bin/gem


How did you install rubygems? I've found problems when using it through the ubuntu repositories in the past. Usually I remove that package and compile and install

sudo apt-get remove rubygems
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar xzvf rubygems-1.3.7.tgz
cd rubygems-1.3.7/
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

or you may just have to symbolic link it:

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem


Do you have multiple version of ruby or rubygems installed?

Type which ruby and which gem to confirm that you are using the correct binaries.


You can also try running your terminal as 'login shell'. That worked for me.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜