加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 库未加载错误 – 错误的ruby

发布时间:2020-12-17 03:55:20 所属栏目:百科 来源:网络整理
导读:我正在使用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
我正在使用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/<appname>/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
      Reason: image not found - /Users/sashafklein/rails/<appname>/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/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require': dlopen(/Users/sashafklein/rails/<appname>/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/<appname>/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
  Reason: image not found - /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
  from /Users/sashafklein/rails/<appname>/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/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:2:in `<top (required)>'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
  from /Users/sashafklein/rails/<appname>/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/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/posix-spawn-0.3.6/lib/posix-spawn.rb:1:in `<top (required)>'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
  from /Users/sashafklein/rails/<appname>/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/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/albino-1.3.3/lib/albino.rb:1:in `<top (required)>'
  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/<appname>/config/application.rb:12:in `<top (required)>'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
  from /Users/sashafklein/rails/<appname>/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

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

解决方法

当宝石链接错误时会发生这种情况,试试这个:

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

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

更新

使用bundlers标志–deployment或–path并不总是安全的,错误消息说:

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

这意味着宝石是用其他ruby编译的,现在找不到它.

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

rm -rf .bundle/ vendor/bundle 
bundle install

解释

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读