gpt4 book ai didi

ruby - 每当我输入 `missing postgres.yml` 时,Rails 不会加载默认项目模板,说 `rails new` 文件

转载 作者:太空宇宙 更新时间:2023-11-03 16:03:29 24 4
gpt4 key购买 nike

每当我尝试使用 rails new -d postgresql -T 开始一个新项目时,它都会给我一个不完整的默认项目并告诉我我缺少 config/databases/postgresql.yml 据我所知,它本来就不应该存在。

有没有人遇到过这个问题或知道我可以尝试解决冲突的一些事情?下面是我尝试创建一个新项目的结果。我可以导航到模板所在的文件夹,但我不知道在那里做任何事情是否有帮助。

Could not find "config/databases/postgresql.yml" in any of your source paths. Your current source paths are: 
/Users/jasonrodriguez/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/generators/rails/app/templates
jasonrodriguez:~ jasonrodriguez$ rails new micropost
Using -d postgresql -T from /Users/jasonrodriguez/.railsrc
create
create README.rdoc
create Rakefile
create config.ru
create .gitignore
create Gemfile
create app
create app/assets/images/.keep
create app/assets/javascripts/application.js
create app/assets/stylesheets/application.css
create app/controllers/application_controller.rb
create app/controllers/concerns/.keep
create app/helpers/application_helper.rb
create app/mailers/.keep
create app/models/.keep
create app/models/concerns/.keep
create app/views/layouts/application.html.erb
identical app/assets/images/.keep
identical app/mailers/.keep
identical app/models/.keep
identical app/controllers/concerns/.keep
identical app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/backtrace_silencers.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/secret_token.rb
create config/initializers/session_store.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/boot.rb
Could not find "config/databases/postgresql.yml" in any of your source paths. Your current source paths are:
/Users/jasonrodriguez/.gem/ruby/2.0.0/gems/railties-4.0.0/lib/rails/generators/rails/app/templates
jasonrodriguez:~ jasonrodriguez$

我尝试删除 .railsrc 并重新启动计算机。我还确保我的 gemfile 有 gem pg 而我的 databse.yml 没有 username 并且我的适配器正确设置为 adapter :postgresql 。不过,该项目只给了我一个不完整的入门模板,其中包括:

app 
bin
config
config.ru
Gemfile
Rakefile
README.rdoc

最佳答案

摆脱标志 -d postgresql -T 并在 Gemfile 中手动将数据库更改为 postgresql。可以找到这样做的说明 here

关于ruby - 每当我输入 `missing postgres.yml` 时,Rails 不会加载默认项目模板,说 `rails new` 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19470842/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com