我希望cloudfoundry的vcap-service-base可以访问cloud_controller的数据库,那么我需要vcap-service-base中的provisioner.rb来要求'active_record'。所以我在 vcap-service-base 的 Gemfile 中添加了“gem”activerecord”,然后运行“bundle install”。在provisioner.rb中,我添加了“require 'active_record'”,在启动cloudfoundry时,总是报错:in `require': no such file to load -- active_record (LoadError),如下:
/root/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/vcap-services-base-1077d35ef73b/lib/base/provisioner.rb:9:in `require': no such file to load -- active_record (LoadError)
from /root/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/vcap-services-base-1077d35ef73b/lib/base/provisioner.rb:9:in `<top (required)>'
from /root/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/vcap-services-base-1077d35ef73b/lib/vcap_services_base.rb:4:in `require'
from /root/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/bundler/gems/vcap-services-base-1077d35ef73b/lib/vcap_services_base.rb:4:in `<top (required)>'
from /root/cloudfoundry/vcap/bin/../services/mysql/bin/mysql_node:7:in `require'
from /root/cloudfoundry/vcap/bin/../services/mysql/bin/mysql_node:7:in `<main>'
根据错误,它是LoadError。但是当我在 /root/cloudfoundry/.deployments/devbox/deploy/rubies/ruby-1.9.2-p180/lib/ruby/gems/1.9.1/gems 中搜索 gem“active_record”时,它就在那里。现在我很困惑是 LoadError 还是我错过了一些重要的事情。为什么在 vcap-service-base 中找不到“require 'active_record'”?