如果被困在这里,我很善良。
调用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& #39;
来自/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
每个& #39;
来自/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
& #39;
来自/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 ?&#39;
来自/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 {{1} } create_migration_file&#39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27: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
invoke_command& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133: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
每个& #39;
来自/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
invoke_all& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232: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
调用& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:277: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
with_padding& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:266: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
_ invoke_from_option_orm& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/command.rb:27: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_command& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/invocation.rb:133: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
每个& #39;
来自/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
invoke_all& #39;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/thor-0.19.1/lib/thor/group.rb:232: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
开始& #39;
来自/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 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
& #39;
来自/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 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
块在要求&#39;
来自/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 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
要求& #39;
来自/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:123:in {{1} } generate_or_destroy&#39;
来自/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:50:in {{1} } run_command&#39!;
来自/home/frank/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/railties-4.2.5.1/lib/rails/commands.rb:17: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
要求& #39;
来自bin / rails:4:在`&#39;
答案 0 :(得分:1)
错误表示您没有database.yml
档
Could not load database configuration. No such file - ["config/database.yml"]
请检查您的config
目录。你能在那里看到database.yml
文件吗?
答案 1 :(得分:0)
I recommended using RVM rather RBenv when it comes to Linux OS, and it's pretty easy to install. Here's what you would need to do to:
Make sure you install curl
sudo apt-get install curl
Then visit the homepage of RVM at https://rvm.io/
add the key by copying and pasting this:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
then inside rails 4 with the following command:
\curl -sSL https://get.rvm.io | bash -s stable --rails
after install is done do this:
/home/<whatever your username is>/.rvm/scripts/rvm
rvm requirements
check to make sure you have ruby, ruby gem, and rails installed with the following command:
ruby -v && gem -v && rails -v
You should now by able to make simple rails app with the following command:
rails new testapp