几天来,我一直在努力使用Rails应用程序。我尽我所能,在SO上问了一些问题,并试图收集所有可能的信息和技巧。以下是摘要:
前几天,当我跑rails s
时,我得到以下内容,因为我知道我删除了ruby-2.0.0-p0:
`require': dlopen(/Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle, 9): Library not loaded: /home/.rvm/rubies/ruby-2.0.0-p0/lib/libruby.2.0.0.dylib (LoadError)
Referenced from: /Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
Reason: image not found - /Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems/posix-spawn-0.3.6/lib/posix_spawn_ext.bundle
我被告知这可能与RVM有关。我从RVM切换到rbenv,我卸载/重新安装了Ruby(不是内置的OS X)和Rails,并在运行rails s
时得到了相同的消息。
然后我卸载并完全删除了Macports并再次使用rbenv并获得相同的消息。
我尝试将/home/.rvm/rubies/ruby-2.0.0-p0/lib/libruby.2.0.0.dylib
符号链接到/usr/local
,我收到了相同的消息。
我尝试过导出DYLD_LIBRARY_PATH
,但我得到了同样的信息。
我卸载了rbenv,Rails,然后我又回到了Macports和RVM,我仍然收到同样的消息。
有人可以帮忙吗?
我正在使用OS X.
ruby -v outputs
ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]
rails -v outputs
Rails 3.2.13
我删除了ruby-2.0.0-p0。
编辑:
grep rvm ~/.bashrc
输出:
PATH=$HOME/.rvm/bin:$PATH # Add RVM to PATH for scripting
grep rvm ~/.bash_profile
输出:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
echo $PATH
输出:
/home/.rvm/gems/ruby-2.0.0-p195/bin:/home/.rvm/gems/ruby-2.0.0-p195@global/bin:/home/.rvm/rubies/ruby-2.0.0-p195/bin:/home/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.4/bin:/usr/local/ActivePerl-5.16/site/bin:/usr/local/ActivePerl-5.16/bin:/usr/local/mysql/bin:/sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/ant/bin:/usr/local/mongodb/bin:/home/bin:/Users/otherhome/Desktop/Sites/apache-ant/bin:/usr/local/bro/bin:/opt/bro/bin
gem env
输出:
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-05-14 patchlevel 195) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /home/.rvm/gems/ruby-2.0.0-p195
- RUBY EXECUTABLE: /home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
- EXECUTABLE DIRECTORY: /home/.rvm/gems/ruby-2.0.0-p195/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /home/.rvm/gems/ruby-2.0.0-p195
- /home/.rvm/gems/ruby-2.0.0-p195@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
rvm info
输出:
system:
uname: "Darwin MacBook-Pro-de-moi.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
rvm:
version: "rvm 1.21.7 () by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "13 hours 8 minutes 18 seconds ago"
ruby:
interpreter: "ruby"
version: "2.0.0p195"
date: "2013-05-14"
platform: "x86_64-darwin12.4.0"
patchlevel: "2013-05-14 revision 40734"
full_version: "ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.4.0]"
homes:
gem: "/home/.rvm/gems/ruby-2.0.0-p195"
ruby: "/home/.rvm/rubies/ruby-2.0.0-p195"
binaries:
ruby: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby"
irb: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/irb"
gem: "/home/.rvm/rubies/ruby-2.0.0-p195/bin/gem"
rake: "/home/.rvm/gems/ruby-2.0.0-p195@global/bin/rake"
environment:
PATH: "/home/.rvm/gems/ruby-2.0.0-p195/bin:/home/.rvm/gems/ruby-2.0.0-p195@global/bin:/home/.rvm/rubies/ruby-2.0.0-p195/bin:/home/.rvm/bin:/opt/local/bin:/opt/local/sbin:/Applications/MAMP/bin/php/php5.4.4/bin:/usr/local/ActivePerl-5.16/site/bin:/usr/local/ActivePerl-5.16/bin:/usr/local/mysql/bin:/sw/bin:/sw/sbin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/ant/bin:/usr/local/mongodb/bin:/home/bin:/Users/otherhome/Desktop/Sites/apache-ant/bin:/usr/local/bro/bin:/opt/bro/bin"
GEM_HOME: "/home/.rvm/gems/ruby-2.0.0-p195"
GEM_PATH: "/home/.rvm/gems/ruby-2.0.0-p195:/home/.rvm/gems/ruby-2.0.0-p195@global"
MY_RUBY_HOME: "/home/.rvm/rubies/ruby-2.0.0-p195"
IRBRC: "/home/.rvm/rubies/ruby-2.0.0-p195/.irbrc"
RUBYOPT: ""
gemset: ""
which ruby
输出:
/home/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
答案 0 :(得分:3)
你认为它应该使用来自捆绑器的--deployment
/或--path
- 它是宝石的路径:/Users/git/gitlab/vendor/bundle/ruby/2.0.0/gems
,不幸的是捆绑器没有足够的智能并且无法正确处理ruby中的更改,您需要再次删除整个目录rm -rf /Users/git/gitlab/vendor/bundle
和bundle install
。
我建议你停止使用来自bundler的--deployment
/或--path
标志,删除目录rm -rf /Users/git/gitlab/vendor/bundle
,rm -rf /Users/git/gitlab/.bundle/
并在gemset中安装gems,这样这个问题就会出现不会再发生了。
如果是capistrano部署,请为bundler/capistrano
设置此标志:
set :bundle_dir, ''
set :bundle_flags, '--system --quiet'
防止在bundler中使用--deployment
和--path
标记。