如果被困在这里,我很友善。 调用active_record/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/application/configuration.rb:110:in database_configuration': Cannot load
Rails.application.database_configuration : (RuntimeError)
Could not load database configuration. No such file - ["config/database.yml"]
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/railtie.rb:117:in
块(2个级别(在' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/lazy_load_hooks.rb:38:IN instance_eval'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/lazy_load_hooks.rb:38:in
execute_hook' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/lazy_load_hooks.rb:45:in block in run_load_hooks'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/lazy_load_hooks.rb:44:in
from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/lazy_load_hooks.rb:44:in run_load_hooks'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/base.rb:315:in
' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5.1/lib/active_record/base.rb:26:in <top (required)>'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/generators/named_base.rb:179:in
pluralize_table_names? 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/generators/named_base.rb:119:in table_name'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activerecord-4.2.5.1/lib/rails/generators/active_record/model/model_generator.rb:21:in
create_migration_file' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in
invoke_command' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
invoke_all' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:115:in
invoke' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:277:in block in _invoke_for_class_method'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/shell.rb:68:in
with_padding' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:266:in _invoke_for_class_method'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:133:in
_invoke_from_option_orm' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27:in run'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in
invoke_command' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in block in invoke_all'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in map'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133:in
invoke_all' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232:in dispatch'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/base.rb:440:in
开始' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/generators.rb:157:in invoke'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/generate.rb:13:in
' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in require'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in
block in require' from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:240:in load_dependency'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/activesupport-4.2.5.1/lib/active_support/dependencies.rb:274:in
require' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/command/commands_tasks.rb:123:IN require_command!'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:130:in
generate_or_destroy' 来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/command/commands_tasks.rb:50:in generate'
from /home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/commands/commands_tasks.rb:39:in
run_command! from/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/command.rb:17:in <top (required)>'
from bin/rails:4:in
require' 从箱/轨:4:在">
错误是说您没有database.yml
文件
Could not load database configuration. No such file - ["config/database.yml"]
请检查您的config
目录。你能看到database.yml
文件吗?
当涉及到Linux操作系统时,我建议使用RVM而不是RBenv,而且安装起来非常容易。以下是您需要执行的操作:
确保安装 curl
sudo apt-get install curl
然后访问RVM的主页 https://rvm.io/
通过复制并粘贴以下内容来添加密钥:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
然后使用以下命令在 Rails 4 中:
curl -sSL https://get.rvm.io | bash -s stable --rails
安装完成后,请执行以下操作:
/home/<whatever your username is>/.rvm/scripts/rvm
rvm requirements
检查以确保使用以下命令安装了 Ruby、Ruby Gem 和 Rails:
ruby -v && gem -v && rails -v
您现在应该能够使用以下命令制作简单的 rails 应用程序:
rails new testapp