【问题标题】:rails postgres zsh Symbol not found: _rb_eEncCompatError (LoadError)rails postgres zsh Symbol not found: _rb_eEncCompatError (LoadError)
【发布时间】:2013-02-01 17:35:02
【问题描述】:

一段时间以来,我一直在解决本地开发 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$

想法?

【问题讨论】:

    标签: ruby-on-rails postgresql zsh iterm


    【解决方案1】:

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

    【讨论】:

    • 我刚刚发布了一个更新,你指的是这个吗?我想在结束之前确认一下。非常感谢。
    • @crazymyki 我认为这解决了它。
    猜你喜欢
    • 2012-09-30
    • 2016-06-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多