rake: command not found
I'm trying to install rails on Ubuntu 9.10.
gem list --local
*** LOCAL GEMS ***
actionmailer (2.3.4, 2.3.2)
actionpack (2.3.4, 2.3.2)
activerecord (2.3.4, 2.3.2)
activeresource (2.3.4, 2.3.2)
activesupport (2.3.4, 2.3.2)
rack (1.0.1)
rails (2.3.4, 2.3.2)
rake (0.8.7)
sqlite3-ruby (1.2.5)
rake
The program 'r开发者_如何学Cake' is currently not installed. You can install it by typing:
sudo apt-get install rake
rake: command not found
How do I solve this?
You need to add /var/lib/gems/1.8/bin to your PATH. Try this command:
export PATH=$PATH:$HOME/bin:/var/lib/gems/1.8/bin
After that rake should work.
You can add this line to your ~/.bashrc so that you don't have to type in this command each time.
Gem is complaining about the rake program (i.e. executable), not the rake gem (you have the latter already installed).
That means that you have to add rake exec to the PATH. Possible rake bin location is /var/lib/gems/1.8/bin/rake
. Add it to your PATH then:
export PATH=${PATH}:/var/lib/gems/1.8/bin
You can also install Rake from the Ubuntu repository (as suggested in the gem output):
sudo apt-get install rake
They are correct, you need to have rake in your path. However if you want to make sure it's just there, instead of exporting it from .bashrc, make a symbolic link:
sudo ln -s /var/lib/gems/1.8/bin/rake /usr/bin/rake
If you do that, you should always be able to use it.
The solution, at least for me, is making the symbolic link.
This is the kind of issue I have to remember. Every time I set a new Ubuntu machine I run into this little problem.
I ran into the same problem on Centos 5.5 and self compiled ruby and rails. (Need it for redmine) When i tried to install passenger using passenger-install-apache2-module, I did an strace and round out, that passenger looks for rake in the ruby/bin directory and not the gems/bin directory, where rake was installed. So a
ln -s /usr/local/ruby1.8.7/lib/ruby/gems/1.8/bin/rake /usr/local/ruby1.8.7/bin
solved it for me. (/usr/local/ruby1.8.7 is where i installed ruby...)
精彩评论