我最近克隆了一个github repo,我正试图让它在我的mac上工作。我克隆了它,做了捆绑安装并安装了所有的宝石。当我尝试做“rails server”时,我收到一个错误:
=> Booting Mongrel
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/application/configuration.rb:86:in `read': No such file or directory - /Users/beatjunkie84/Desktop/Teamly/config/database.yml (Errno::ENOENT)
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/application/configuration.rb:86:in `database_configuration'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activerecord-3.0.1/lib/active_record/railtie.rb:58
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/lazy_load_hooks.rb:26:in `on_load'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activerecord-3.0.1/lib/active_record/railtie.rb:57
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/initializable.rb:25:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/initializable.rb:25:in `run'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/initializable.rb:50:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/initializable.rb:49:in `each'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/initializable.rb:49:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/application.rb:134:in `initialize!'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/application.rb:77:in `send'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/railties-3.0.1/lib/rails/application.rb:77:in `method_missing'
from /Users/beatjunkie84/Desktop/Teamly/config/environment.rb:5
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `polyglot_original_require'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/polyglot-0.3.1/lib/polyglot.rb:64:in `require'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:225:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/activesupport-3.0.1/lib/active_support/dependencies.rb:239:in `require'
from /Users/beatjunkie84/Desktop/Teamly/config.ru:3
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/rack-1.2.1/lib/rack/builder.rb:46:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.8.7-p302@rails301/gems/rack-1.2.1/lib/rack/builder.rb:46:in `initialize'
from /Users/beatjunkie84/Desktop/Teamly/config.ru:1:in `new'
from /Users/beatjunkie84/Desktop/Teamly/config.ru:1
我该怎么做才能解决这个问题?我没有database.yml,这就是问题所在。但是,克隆它时,回购都没有。为什么要查找一个不应该在那里开始的文件?
答案 0 :(得分:5)
当人们在github上推送他们的repo时,他们会从该repo中排除配置文件。您需要创建一个database.yml文件才能使您的应用程序正常工作。
这是一个例子。
development:
adapter: mysql
database: bibapp_development
username: root
password:
test:
adapter: mysql
database: bibapp_test
username: root
password:
production:
adapter: mysql
database: bibapp_production
username: root
password: