gpt4 book ai didi

ruby - Rails 错误 - Psych::SyntaxError - YAML

转载 作者:行者123 更新时间:2023-11-29 13:56:35 24 4
gpt4 key购买 nike

这是我的第一个 Rails 应用程序,非常感谢任何帮助。我已经在该应用程序上工作了几个星期,并且在运行 bundle install 时才开始遇到错误。

/usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/psych.rb:370:in `parse':   (<unknown>): mapping values are not allowed in this context at line 2 column 29 (Psych::SyntaxError)

如果有帮助,我可以发布完整的跟踪记录。我使用 yamllint 和这篇文章中的脚本验证了 .yml 文件 rails error, couldn't parse YAML

require 'yaml'

d = Dir["./**/*.yml"]
d.each do |file|
begin
puts "checking : #{file}"
f = YAML.load_file(file)
rescue Exception
puts "failed to read #{file}: #{$!}"
end
end

Rails 控制台输出:

2.1.5p273 :001 > load 'yamlerrors.rb'
checking : ./test/fixtures/comments.yml
checking : ./test/fixtures/posts.yml
checking : ./test/fixtures/users.yml
checking : ./config/database.yml
checking : ./config/secrets.yml
checking : ./config/locales/en.yml
=> true

还有其他建议去哪里看吗?我试过查看这里提到的 .gemrc 文件 Having trouble installing any ruby 1.9.x (with rbenv) on mac osx due to psych YAML parse errors但没有。我正在使用 PostgreSQL 在 Cloud9 中进行开发。我认为问题是在我尝试使用 Fog 在生产环境中连接到 AWS 时开始的。

最佳答案

我遇到了类似的问题,并通过删除 yml 文件中的多余空格解决了这个问题。

关于ruby - Rails 错误 - Psych::SyntaxError - YAML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30584694/

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