gpt4 book ai didi

mysql - 使用 mysql 创建新项目时找不到 "config/databases/mysql.yml"

转载 作者:行者123 更新时间:2023-11-29 07:28:59 26 4
gpt4 key购买 nike

有人可以帮助我吗?当我想为 Ruby on Rails 创建新项目时出现此错误

 ronggothelast  ~  belajar-rails  rails new kodooe -d mysql
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /home/ronggothelast/belajar-rails/kodooe/.git/
create package.json
create app
create app/assets/config/manifest.js
create app/assets/javascripts/application.js
create app/assets/javascripts/cable.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/assets/images/.keep
create app/assets/javascripts/channels
create app/assets/javascripts/channels/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/bundle
create bin/rails
create bin/rake
create bin/setup
create bin/update
create bin/yarn
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/spring.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/application_controller_renderer.rb
create config/initializers/assets.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/content_security_policy.rb
create config/initializers/cookies_serializer.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_framework_defaults_5_2.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb

Could not find "config/databases/mysql.yml" in any of your source paths. Your current source paths are: /home/ronggothelast/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/generators/rails/app/templates

最佳答案

您似乎已经使用删除系统上所有 MySQL 文件的命令从模板文件夹中删除了 mysql.yml.tt。
要解决这个问题:1)在templates/config/databases/目录下创建mysql.yml.tt文件

$ touch ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt

2) 粘贴 original file from rails github 中的基本代码使用 vim 或从源文件打开文件并粘贴所有代码。

$ vim ~/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/railties-5.2.1/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt

现在您可以使用 rails new app-name -d mysql 重新制作项目

关于mysql - 使用 mysql 创建新项目时找不到 "config/databases/mysql.yml",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52482859/

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