首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >rake db:create - rake中止

rake db:create - rake中止
EN

Stack Overflow用户
提问于 2020-10-27 01:58:15
回答 2查看 529关注 0票数 0

您好,我正在尝试使用此链接创建一个刮板程序,但我在尝试创建一个db https://towardsdatascience.com/job-board-scraping-with-rails-872c432ed2c8时遇到了困难。

当我尝试在文件夹内部和外部创建rake db:create时,我得到了这个错误,我不确定为什么,非常感谢。我一直在密切关注链接,所以我有所有相同的文件,并确保一切都安装正确。

代码语言:javascript
复制
rake aborted!
ActiveRecord::DatabaseConfigurations::InvalidConfigurationError: 
'{ default =>  }' is not a valid configuration. Expected '' to be a URL string or a Hash.

这是我的database.yml文件

代码语言:javascript
复制
# 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.

提前感谢大家!

更新

谢谢你的指针,我把database.yml文件缩进了,但我觉得有个错误告诉我要去掉制表符。现在的新问题:

代码语言:javascript
复制
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"
EN

回答 2

Stack Overflow用户

发布于 2020-10-27 02:09:39

该文件位于YAML format中。子项必须缩进。

代码语言:javascript
复制
default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default  
  database: scraper_development
票数 0
EN

Stack Overflow用户

发布于 2020-10-27 17:15:52

您可以在gem文件中添加“gem 'pg',‘YAML 0.18','< 2.0’”,并在>=文件中进行必要的设置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64542482

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档