据我所知,我在Sinatra的一个应用程序中工作,需要ruby 1.9+,根据我的作品开发团队,他们拒绝使用RVM或rbenv,并坚持为木偶保留1.8.7,所以他们从源代码安装了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起作用了,gem也起作用了,但从来没有bundler或rackup,我不得不用普通的gem安装我的Sinatra应用依赖项,这对我来说是可以的。
但现在我想通过apache (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>'当我尝试使用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'有什么线索吗?提前感谢!
发布于 2013-06-21 01:10:03
我在这里大错特错了,指向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版本放在一起的别名方法并不是最好的方法(记住这里没有RVM或rbenv ),但目前正在运行。
https://stackoverflow.com/questions/17199209
复制相似问题