简体   繁体   English

rake db:create - rake 中止

[英]rake db:create - rake aborted

Hi im trying to follow this link to create a scraper and I am stuck trying to create a db https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8嗨,我正在尝试按照此链接创建刮板,但我一直在尝试创建数据库https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8

I get this error when typing rake db:create I've tried creating inside and outside the folder and I get this error I am not sure why, thank you very much.输入rake db:create时出现此错误 我已尝试在文件夹内部和外部创建,但出现此错误我不知道为什么,非常感谢。 I have been closely following the link so I have all the same files and am sure everything was installed properly.我一直在密切关注该链接,因此我拥有所有相同的文件,并且确信一切都已正确安装。

rake aborted!
ActiveRecord::DatabaseConfigurations::InvalidConfigurationError: 
'{ default =>  }' is not a valid configuration. Expected '' to be a URL string or a Hash.

This is my database.yml file这是我的 database.yml 文件

# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
adapter: postgresql
pool: 5
timeout: 5000

development:
<<: *default  
database: scraper_development

test:
<<: *default
database: scraper_test

production:
<<: *default
url: <%= ENV['DATABASE_URL'] %> 

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

Thanks in advance everyone!提前谢谢大家!

Update更新

Thanks for the pointer I had [the database.yml file] indented but I though an error told me to remove tabs.感谢我缩进了[ database.yml文件]的指针,但我虽然有一个错误告诉我删除标签。 new issue now:现在的新问题:

could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Couldn't create 'scraper_development' database.
Please check your configuration.

rails aborted!

PG::ConnectionBad: could not connect to server: No such file or directory

Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"

Hi im trying to follow this link to create a scraper and I am stuck trying to create a db https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8嗨,我正在尝试按照此链接创建刮刀,但我在尝试创建数据库时遇到困难https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8

I get this error when typing rake db:create I've tried creating inside and outside the folder and I get this error I am not sure why, thank you very much.键入rake db:create时出现此错误,我尝试在文件夹的内部和外部创建,但收到此错误,我不确定为什么,非常感谢。 I have been closely following the link so I have all the same files and am sure everything was installed properly.我一直在密切关注该链接,因此我拥有所有相同的文件,并确保一切都已正确安装。

rake aborted!
ActiveRecord::DatabaseConfigurations::InvalidConfigurationError: 
'{ default =>  }' is not a valid configuration. Expected '' to be a URL string or a Hash.

This is my database.yml file这是我的 database.yml 文件

# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
adapter: postgresql
pool: 5
timeout: 5000

development:
<<: *default  
database: scraper_development

test:
<<: *default
database: scraper_test

production:
<<: *default
url: <%= ENV['DATABASE_URL'] %> 

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

Thanks in advance everyone!提前谢谢大家!

Update更新

Thanks for the pointer I had [the database.yml file] indented but I though an error told me to remove tabs.感谢您的 [the database.yml文件] 缩进的指针,但我虽然错误告诉我删除选项卡。 new issue now:现在新问题:

could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Couldn't create 'scraper_development' database.
Please check your configuration.

rails aborted!

PG::ConnectionBad: could not connect to server: No such file or directory

Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"

Hi im trying to follow this link to create a scraper and I am stuck trying to create a db https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8嗨,我正在尝试按照此链接创建刮刀,但我在尝试创建数据库时遇到困难https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8

I get this error when typing rake db:create I've tried creating inside and outside the folder and I get this error I am not sure why, thank you very much.键入rake db:create时出现此错误,我尝试在文件夹的内部和外部创建,但收到此错误,我不确定为什么,非常感谢。 I have been closely following the link so I have all the same files and am sure everything was installed properly.我一直在密切关注该链接,因此我拥有所有相同的文件,并确保一切都已正确安装。

rake aborted!
ActiveRecord::DatabaseConfigurations::InvalidConfigurationError: 
'{ default =>  }' is not a valid configuration. Expected '' to be a URL string or a Hash.

This is my database.yml file这是我的 database.yml 文件

# SQLite. Versions 3.8.0 and up are supported.
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
adapter: postgresql
pool: 5
timeout: 5000

development:
<<: *default  
database: scraper_development

test:
<<: *default
database: scraper_test

production:
<<: *default
url: <%= ENV['DATABASE_URL'] %> 

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

Thanks in advance everyone!提前谢谢大家!

Update更新

Thanks for the pointer I had [the database.yml file] indented but I though an error told me to remove tabs.感谢您的 [the database.yml文件] 缩进的指针,但我虽然错误告诉我删除选项卡。 new issue now:现在新问题:

could not connect to server: No such file or directory
Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Couldn't create 'scraper_development' database.
Please check your configuration.

rails aborted!

PG::ConnectionBad: could not connect to server: No such file or directory

Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"

I ran into the same problem and what I did was to fix the indentation, and then it worked.我遇到了同样的问题,我所做的是修复缩进,然后它就起作用了。

The database.yml file is in YAML format. database.yml文件采用YAML 格式。 so make sure the sub-items are indented correctly.所以请确保子项正确缩进。 Please check the example below on how you are supposed to indent it.请检查下面的示例,了解您应该如何缩进它。

This is how your database.yml file should look like

default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default  
  database: scraper_development

test:
  <<: *default
  database: scraper_test

production:
  <<: *default
  url: <%= ENV['DATABASE_URL'] %> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM