rails postgres zsh找不到符号:_rb_eEncCompatError(LoadError)

时间:2013-02-01 17:35:02

标签: ruby-on-rails postgresql zsh iterm

我一直在本地开发rails设置中解决一个非常奇怪的问题。虽然我无法准确跟踪它何时开始,但我想发布此内容以查看是否有其他人已经看到此问题或者有关于如何解决此问题的想法。

如何复制此错误。我启动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$

思想?

1 个答案:

答案 0 :(得分:0)

问题的根源在于.zshrc引用ruby-1.9.3-head,并且正在查看ruby-1.9.3-p374以查找pg_ext.bundle。不匹配的版本会导致各种奇怪的现象。