关于 ruby?? on rails:bundle install Library not loaded 错误

bundle install Library not loaded error

环境:

  • rails 3.2.11
  • Heroku 竹-mri-1.9.2
  • 使用 RVM
  • ruby-1.9.2-p290

我的 .rvmrc 配置为使用 ruby??-1.9.2-p290

当运行 bundle install 命令时,我得到这个:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle, 9): Library not loaded: /opt/local/lib/libcrypto.1.0.0.dylib (LoadError)
  Referenced from: /Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle
  Reason: image not found - /Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle
    from /Users/joel/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/definition.rb:1:in `<top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/cli.rb:245:in `install'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/bin/bundle:19:in `load'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/bin/bundle:19:in `<main>'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/joel/.rvm/gems/ruby-1.9.2-p290@global/bin/ruby_noexec_wrapper:14:in `<main>'

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

试一试

1
2
3
rvm pkg install openssl

rvm reinstall all --force

然后 cd .. 和 cd project_folder

1
bundle install

再次正确安装所有 gem

第一个错误消失了
但是当我使用 ruby?? 1.9.3 进入另一个项目时,我收到一个"新"错误,所以我似乎无法同时使用 1.9.2 和 1.9.3 ...或者我每次都必须重新安装我的ruby???我一定错过了什么。

这里是新错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': dlopen(/Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish (LoadError)
  Referenced from: /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle
  Expected in: flat namespace
 in /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle - /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/x86_64-darwin11.4.2/digest/sha1.bundle
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/definition.rb:1:in `<top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:148:in `definition'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/cli.rb:301:in `update'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/bin/bundle:19:in `load'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@global/bin/bundle:19:in `<main>'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@creativebank/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/joel/.rvm/gems/ruby-1.9.3-p429@creativebank/bin/ruby_noexec_wrapper:14:in `<main>'


既然您提到您最近从 MacPorts 迁移到 Homebrew,我想说您可能有一些 gem 是针对不再存在的 MacPorts 安装库 (in /opt/local) 编译的.您应该重新编译这些 gem 以链接到这些库的 Homebrew 提供的版本(或 Apple 的版本,如果它们存在)。您可以使用本机组件重新编译 gem,只需重新安装它即可。