Library not loaded error — wrong ruby

随声附和 提交于 2019-12-04 09:17:13

this kind of thing could happen when gems are linked wrong, try this:

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

This will reinstall the ruby and make all gems pristine, which should prevent such problems from happening - unless gem authors did some extra tricks which go out of standard ruby detection.

Update

Using bundlers flag --deployment or --path is not always safe, the error message says:

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

Which means the gem was compiled with the other ruby and now can not find it.

The simplest way to fix it is to stop using --deployment flag, as it is persisted the easiest way to get rid of it (and all other potentially dangerous settings) is:

rm -rf .bundle/ vendor/bundle 
bundle install

Interpretation

Bundler does great job filtering gems in runtime, unfortunately it enforces another layer of filtering with the --deployment flag, which forces installation of gems to path that is common for multiple rubies - in this case: ruby/1.9.1, this is unsafe as rubies can be compiled with different settings which can break c-extension gems used in different ruby.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!