一段时间以来,我一直在本地开发轨道设置中解决一个非常奇怪的问题。 虽然我无法准确跟踪它何时开始,但我想发布此内容以查看是否有其他人看到此问题或对如何解决它有想法。
如何复制此错误。我启动了 iterm2 (zsh),并在项目的第一个选项卡中运行 rails s
来启动服务器。 与大多数开发人员一样,我按cmd + t打开一个新选项卡,当我尝试rails c
rails控制台运行时,将显示此错误。 就像我被限制在一个标签上一样。 我在网上几乎没有发现关于这个问题的研究或方向,我希望有人能为我指出正确的方向。
它似乎在 PG gem 上失败,我已经验证我正在运行最新版本。
我的 .zshrc 文件:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
export PATH=/Users/chrishough:/Users/chrishough/.rvm/gems/ruby-1.9.3-head/bin:/Users/chrishough/.rvm/gems/ruby-1.9.3-head@global/bin:/Users/chrishough/.rvm/rubies/ruby-1.9.3-head/bin:/Users/chrishoug$
这是终端中弹出的确切错误的副本。
/Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle: dlopen(/Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle, 9): Symbol not found: _rb_eEncCompatError (LoadError)
Referenced from: /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle
Expected in: flat namespace
in /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle - /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg_ext.bundle
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/pg-0.14.1/lib/pg.rb:4
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /Users/chrishough/Huedio/Code/Profiles/config/application.rb:13
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/railties-3.2.11/lib/rails/commands.rb:39:in `require'
from /Users/chrishough/.rvm/gems/ruby-1.9.3-p374@My-Application-Profiles/gems/railties-3.2.11/lib/rails/commands.rb:39
from script/rails:6:in `require'
from script/rails:6
非常感谢大家的帮助。 祝您周末愉快。
更新
从@crazymykl我更新了我的 .zshrc 配置,看起来像这样,错误似乎已经消失了。
# RUBY DEVELOPMENT
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
# export PATH=/Users/chrishough:/Users/chrishough/.rvm/gems/ruby-1.9.3-head/bin:/Users/chrishough/.rvm/gems/ruby-1.9.3-head@global/bin:/Users/chrishough/.rvm/rubies/ruby-1.9.3-head/bin:/Users/chrishoug$
思潮?
问题的根源是你的 .zshrc 指的是 ruby-1.9.3-head
,它正在查看ruby-1.9.3-p374
以找到 pg_ext.bundle。不匹配的版本会导致各种奇怪。