gpt4 book ai didi

ruby-on-rails - 使用了错误的 ruby​​ 版本

转载 作者:行者123 更新时间:2023-12-03 15:59:45 24 4
gpt4 key购买 nike

我正在尝试让 Rails 在运行 Lion 的 Mac 上运行。我正在使用 rvm,它显示我正在使用 ruby​​ 1.9.2p312 但是当我去启动服务器时,我收到一个错误,引用 ruby​​ 1.8 并且即使在此错误之前我运行了 bundle install 并没有安装 rails它成功安装了我需要的一切。

关于如何解决这个问题的任何想法?

好吧,看来 1.8 的错误已经消失了。这是新的错误和捆绑显示:

bundle exec rails s
/Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require': no such file to load -- spec (LoadError)
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/anthonyd/Sites/rails/reminders/config/application.rb:7:in `<top (required)>'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `require'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:52:in `block in <top (required)>'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap'
from /Users/anthonyd/.rvm/gems/ruby-1.9.2-head/gems/railties-3.1.3/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'


bundle show
Gems included by the bundle:
* actionmailer (3.1.3)
* actionpack (3.1.3)
* activemodel (3.1.3)
* activerecord (3.1.3)
* activeresource (3.1.3)
* activesupport (3.1.3)
* arel (2.2.1)
* aws-s3 (0.6.2)
* bbenezech-nested_form (0.0.2)
* bcrypt-ruby (3.0.1)
* bootstrap-sass (1.4.0)
* builder (3.0.0)
* bundler (1.0.21)
* coffee-rails (3.1.1)
* coffee-script (2.2.0)
* coffee-script-source (1.1.3)
* devise (1.5.2 b303429)
* diff-lcs (1.1.3)
* erubis (2.7.0)
* execjs (1.2.9)
* haml (3.1.4)
* hike (1.2.1)
* hpricot (0.8.5)
* i18n (0.6.0)
* jquery-rails (1.0.19)
* json (1.6.3)
* kaminari (0.12.4)
* mail (2.3.0)
* mime-types (1.17.2)
* multi_json (1.0.4)
* nokogiri (1.5.0)
* orm_adapter (0.0.5)
* polyglot (0.3.3)
* rack (1.3.5)
* rack-cache (1.1)
* rack-mount (0.8.3)
* rack-pjax (0.5.5)
* rack-ssl (1.3.2)
* rack-test (0.6.1)
* rails (3.1.3)
* rails_admin (0.0.1 6120ad4)
* railties (3.1.3)
* rake (0.9.2.2)
* rdoc (3.11)
* remotipart (1.0.1)
* rspec (2.7.0)
* rspec-core (2.7.1)
* rspec-expectations (2.7.0)
* rspec-mocks (2.7.0)
* sass (3.1.11)
* sass-rails (3.1.5)
* sprockets (2.0.3)
* sqlite3 (1.3.4)
* sqlite3-ruby (1.3.3)
* thor (0.14.6)
* tilt (1.3.3)
* treetop (1.4.10)
* tzinfo (0.3.31)
* warden (1.1.0)
* xml-simple (1.1.1)

rails s
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem rails (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /usr/bin/rails:18

**ruby -v**
ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0]

**RVM Info**:

system:
uname: "Darwin Anthony-DeFreitass-MacBook-Pro.local 11.2.0 Darwin Kernel Version 11.2.0: Tue Aug 9 20:54:00 PDT 2011; root:xnu-1699.24.8~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"

rvm:
version: "rvm 1.10.0-pre by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]"

ruby:
interpreter: "ruby"
version: "1.9.2p312"
date: "2011-08-11"
platform: "x86_64-darwin11.2.0"
patchlevel: "2011-08-11 revision 32926"
full_version: "ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin11.2.0]"

homes:
gem: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head"
ruby: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head"

binaries:
ruby: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/ruby"
irb: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/irb"
gem: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin/gem"
rake: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin/rake"

environment:
PATH: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head/bin:/Users/anthonyd/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/bin:/Users/anthonyd/.rvm/bin:/usr/bin:/usr/local/bin:/Users/anthonyd:/Users/anthonyd/imagemagick/bin:/Users/anthonyd/imagemagick/lib:.rvm/scripts/rvm:/usr/local/sbin:/usr/local/mysql/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin"
GEM_HOME: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head"
GEM_PATH: "/Users/anthonyd/.rvm/gems/ruby-1.9.2-head:/Users/anthonyd/.rvm/gems/ruby-1.9.2-head@global"
MY_RUBY_HOME: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head"
IRBRC: "/Users/anthonyd/.rvm/rubies/ruby-1.9.2-head/.irbrc"
RUBYOPT: ""
gemset: ""

最佳答案

如果使用 RVM,请确保在您的 ~/.bash_profile 文件中,rvm 的路径位于其他路径之前。

例如,在任何 PATH 声明之前将其放入 ~/.bash_profile 中:

export PATH=:~/.rvm/bin/:~/.rvm/gems/gems/

然后你的导出声明的其余部分可能看起来像这样(这只是一个例子,你不需要把它放进去,我只是把它包括在内,这样你就可以看到文件的样子,但上面那行你绝对需要):
export PATH=:~/bin/:/usr/local/Cellar/mysql/bin:/usr/local/Cellar:/usr/local/sphinx:/usr/sbin:$PATH

最后,如果你像我一样放弃了 RVM 并使用了 rbenv 那么替换第一个 export PATH与此相符:
export PATH="$HOME/.rbenv/bin:$PATH"

这些更改应该使系统先查看您的 RVM 文件,然后再查看 /System/Library/Frameworks/Ruby.framework 中的内置文件。

祝你好运。

关于ruby-on-rails - 使用了错误的 ruby​​ 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8350542/

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