库没有加载错误 – 错误的ruby

我正在使用RVM和Ruby 1.9.3 p448,但是当我尝试运行我的rails服务器时,我收到此错误(加上其他一些东西)

9): Library not loaded: /Users/sashafklein/.rvm/rubies/ruby-1.9.3-p327/lib/libruby.1.9.1.dylib (LoadError) Referenced from: /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle Reason: image not found - /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle 

奇怪的是,它引用了ruby-1.9.3-p327,这甚至都不是我的RVM安装之一。 我应该删除那个Ruby文件夹吗?它没有找到libruby? 或者还有什么可能是错的?

编辑 – 完全错误

 /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle, 9): Library not loaded: /Users/sashafklein/.rvm/rubies/ruby-1.9.3-p327/lib/libruby.1.9.1.dylib (LoadError) Referenced from: /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle Reason: image not found - /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2:in `' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix-spawn.rb:1:in `' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/albino-1.3.3/lib/albino.rb:1:in `' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require' from /Users/sashafklein/.rvm/gems/ruby-1.9.3-p448/gems/bundler-1.3.5/lib/bundler.rb:132:in `require' from /Users/sashafklein/rails//config/application.rb:12:in `' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in ' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap' from /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `' from script/rails:6:in `require' from script/rails:6:in `' 

白化gem似乎是在这个底部,但我认为它对应用程序是必要的,所以我不能把它拿出来。 我尝试了gem卸载albino(没有输出)然后捆绑安装,但是没有修复任何东西。 同样,捆绑更新,以及下面的mpapis和sahil的帮助。

当gem链接错误时会发生这种事情,试试这个:

 rvm get head rvm reinstall 1.9.3-p448 rvm use 1.9.3-p448 

这将重新安装ruby并使所有gem保持原始状态,这可以防止这样的问题发生 – 除非gem作者做了一些超出标准ruby检测的额外技巧。

更新

使用bundler的标志--path--path并不总是安全的,错误消息说:

 /Users/sashafklein/rails//vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle 

这意味着gem是用其他ruby编译的,现在找不到它。

修复它的最简单方法是停止使用--deployment标志,因为它是持久化的最简单的方法来摆脱它(以及所有其他潜在危险的设置)是:

 rm -rf .bundle/ vendor/bundle bundle install 

解释

Bundler在运行时很好地过滤了gem,不幸的是它使用--deployment标志强制执行另一层过滤,这会强制将gem安装到多个ruby常见的路径 – 在这种情况下: ruby/1.9.1 ,这是不安全的因为ruby可以用不同的设置编译,这可以打破不同ruby中使用的c-extension gems。