Ruby 捆绑程序在-require';下失败:没有这样的文件要加载--bundler

Ruby 捆绑程序在-require';下失败:没有这样的文件要加载--bundler,ruby,rubygems,gem,bundler,passenger,Ruby,Rubygems,Gem,Bundler,Passenger,据我所知,我在一个Sinatra应用程序中工作,该应用程序需要ruby 1.9+,根据我的works devops团队的说法,他们拒绝使用RVM或rbenv,并坚持为puppet保留1.8.7,因此他们从源代码中安装了1.9.3 /opt/ruby-1.9.3/bin/ruby 对于我的用户,我必须在.bash_配置文件中创建几个别名 alias ruby="/opt/ruby-1.9.3/bin/ruby" alias gem="/opt/ruby-1.9.3/bin/gem" alias

据我所知,我在一个Sinatra应用程序中工作,该应用程序需要ruby 1.9+,根据我的works devops团队的说法,他们拒绝使用RVM或rbenv,并坚持为puppet保留1.8.7,因此他们从源代码中安装了1.9.3

/opt/ruby-1.9.3/bin/ruby
对于我的用户,我必须在.bash_配置文件中创建几个别名

alias ruby="/opt/ruby-1.9.3/bin/ruby"
alias gem="/opt/ruby-1.9.3/bin/gem"
alias erb="/opt/ruby-1.9.3/bin/erb"
alias bundle="/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/bin/bundle"
alias rackup="/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/rack-1.5.2/bin/rackup"
ruby工作正常,gem也可以,但从来没有bundler或rackup,我必须用普通的gem安装来安装我的Sinatra应用程序依赖项,这对我来说没问题

但是现在我想通过apache with passenger(mod_rails)为应用程序提供服务,我得到了关于找不到gems的错误,例如:

Could not find nokogiri-1.5.9 in any of the sources (Bundler::GemNotFound)
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `map!'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/spec_set.rb:85:in `materialize'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:159:in `specs_for'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:148:in `requested_specs'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/environment.rb:18:in `requested_specs'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:13:in `setup'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:120:in `setup'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
  /opt/ruby-1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
  /opt/ruby-1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
  /opt/ruby-1.9.3/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.5/lib/phusion_passenger/loader_shared_helpers.rb:212:in `run_load_path_setup_code'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:73:in `preload_app'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:127:in `<module:App>'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:6:in `<module:PhusionPassenger>'
  /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:5:in `<main>'
第7行中的文件内容为:

require 'bundler'

有什么线索吗?提前谢谢

我在这里大错特错了,指向bundle和rackup的别名指向了一个不正确的路径,结果是这样的:

alias ruby="/opt/ruby-1.9.3/bin/ruby"
alias gem="/opt/ruby-1.9.3/bin/gem"
alias erb="/opt/ruby-1.9.3/bin/erb"
alias bundle="/opt/ruby-1.9.3/bin/bundle"
alias rackup="/opt/ruby-1.9.3/bin/rackup"
可能将两个ruby版本放在一起的alias方法不是最好的(请记住这里没有RVM或rbenv),但现在正在运行

alias ruby="/opt/ruby-1.9.3/bin/ruby"
alias gem="/opt/ruby-1.9.3/bin/gem"
alias erb="/opt/ruby-1.9.3/bin/erb"
alias bundle="/opt/ruby-1.9.3/bin/bundle"
alias rackup="/opt/ruby-1.9.3/bin/rackup"