我有一个工作的centOS服务器,据我所知,我的工作在一个需要ruby 1.9+的Sinatra应用程序中,需要ruby 1.8.7,因为我的工作devops团队,他们拒绝使用RVM或rbenv,坚持保持1.8.7 for puppet,所以他们从源代码安装1.9.3
/opt/ruby-1.9.3/bin/ruby
对于我的用户,我必须在.bash_profile
中创建一些别名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工作,宝石也,但从来没有捆绑或机架,我不得不安装我的Sinatra应用程序依赖与普通的gem安装,这对我来说没问题。
但是现在我想通过apache与乘客(mod_rails)一起提供应用程序,我得到关于未找到宝石的错误,例如:
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>'
当我尝试使用bundler时,我收到此错误:
$ bundle install
/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:7:in `require': no such file to load -- bundler (LoadError)
from /opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:7
第7行的文件内容是:
require 'bundler'
任何线索?提前致谢!
答案 0 :(得分:0)
我在这里非常错误,指向捆绑和机架的别名指向不正确的路径,他们最终是这样的:
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版本放在一起的别名方法可能不是最好的(请记住这里没有RVM或rbenv),但现在正在使用