[英]Ruby: `gem_original_require': no such file to load — rails (LoadError)
I just deleted ruby 1.9.1 and installed 1.8.7, but my bash still points at 1.9.1 for when I look for rails. 我刚刚删除了ruby 1.9.1并安装了1.8.7,但是当我寻找rails时,我的bash仍然指向1.9.1。
emai@vpc-db:~$ rails --version
bash: /usr/local/bin/rails: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
emai@vpc-db:~$ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
Can anyone help? 有人可以帮忙吗? How do I make bash look at 1.8.7? 如何让bash看看1.8.7?
Your ruby is pretty old (and as of this week, officially deprecated). 你的红宝石很旧(截至本周,正式弃用)。 It's also really weird that your gems are installed in /usr/local/bin
. 你的宝石安装在/usr/local/bin
也很奇怪。
You might want to look into rbenv 你可能想看看rbenv
This will probably clean up your issue right away 这可能会立即清理您的问题
After you have rbenv setup, I compile my rubies like this 你rbenv设置后 ,我编译我的红宝石这样的
# start in your home directory
cd $HOME
# make a src folder for compiling ruby
mkdir -p .src && cd .src
# download ruby
curl -O ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
# extract compressed file
tar -xzf ruby-2.0.0-p247.tar.gz
# cd to folder
cd ruby-2.0.0-p247
# configure
./configure --prefix=$HOME/.rbenv/versions/2.0.0-p247 --with-opt-dir=/path/to/openssl --enable-shared
# make and install
make && make install
# cleanup
rm -rf ruby-2.0.0-p247
Now let's use it! 现在让我们使用它!
# make rbenv aware of our new rubies
rbenv rehash
# set our new version as the default
rbenv global 2.0.0-p247
# let's check it out!
ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
Now let's get that rails
going 现在,让我们说rails
会
# install rails
gem install rails
# check the version
rails --version
Rails 4.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.