gpt4 book ai didi

ruby-on-rails - 似乎无法安装 "use"RVM Ruby

转载 作者:太空宇宙 更新时间:2023-11-03 18:25:18 24 4
gpt4 key购买 nike

当我尝试调用 rails、rails -vrails -c 时出现此错误:

/usr/lib/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:1082:in `gem'
from /usr/bin/rails:18

我安装了 RVM,用它来安装 Ruby 1.9.3,然后切换到它 rvm use 1.9.3 --default

当我 ruby -v 时:

ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

我还 gem install rails --no-rdoc --no-ri 并检查了...ls ~/ruby/gems/gems/:

actionmailer-3.2.8/    journey-1.0.4/     rake-0.9.2.2/
actionpack-3.2.8/ json-1.7.5/ rdoc-3.12/
activemodel-3.2.8/ mail-2.4.4/ rubygems-bundler-1.0.7/
activerecord-3.2.8/ mime-types-1.19/ rvm-1.11.3.5/
activeresource-3.2.8/ multi_json-1.3.6/ sprockets-2.1.3/
activesupport-3.2.8/ polyglot-0.3.3/ sprockets-2.4.5/
arel-3.0.2/ rack-1.4.1/ thor-0.16.0/
builder-3.0.0/ rack-cache-1.2/ tilt-1.3.3/
bundler-1.1.5/ rack-ssl-1.3.2/ treetop-1.4.10/
erubis-2.7.0/ rack-test-0.6.1/ tzinfo-0.3.33/
hike-1.2.1/ rails-3.2.8/
i18n-0.6.0/ railties-3.2.8/

如果我 echo $GEM_PATH:

/home/flackend/.rvm/gems/ruby-1.9.3-p194:/home/flackend/.rvm/gems/ruby-1.9.3-p194@global

echo $PATH:

/home/flackend/.rvm/gems/ruby-1.9.3-p194/bin:/home/flackend/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/flackend/.rvm/rubies/ruby-1.9.3-p194/bin:/home/flackend/.rvm/bin:/usr/local/jdk/bin:/home/flackend/perl5/bin:/usr/kerberos/bin:/usr/lib/courier-imap/bin:/usr/lib64/ccache:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/home/flackend/.rvm/bin:/home/flackend/bin

cat ~/.bashrc:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

cat ~/.bash_profile:

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

所以某个地方有一条路径,上面写着查看系统 Ruby 安装。有任何想法吗?谢谢!


编辑

好的,另外,如果我切换回系统 Ruby,rvm 使用系统,和 rails -v,我得到:

Rails 2.3.8

所以我完全不知道这个错误表明什么。

最佳答案

您还没有完成 rvm 安装。您需要在 .bashrc 中通过命令在/usr/bin 之前添加 ~/.rvm bin 路径:

[[ -s "/Users/pftg/.rvm/scripts/rvm" ]] && source "/Users/pftg/.rvm/scripts/rvm".

要测试,只需检查 $PATH 环境。应该类似于:

/.../.rvm/gems/ruby-1.9.3-p125@global/bin:/.../.rvm/rubies/ruby-1.9.3-p125/bin:/.../.rvm/bin:/usr/local/bin

关于ruby-on-rails - 似乎无法安装 "use"RVM Ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12105744/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com