当我在安装Figaro并尝试在我的application.yml文件中添加变量后尝试启动服务器时,我遇到了大量错误。任何人都可以解释我需要做些什么来修复。我已经阅读了错误,但我不确定。
服务器错误
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 10 column 1 (Psych::SyntaxError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/psych.rb:129:in `load'
from /Library/Ruby/Gems/2.0.0/gems/figaro-0.7.0/lib/figaro.rb:21:in `raw'
from /Library/Ruby/Gems/2.0.0/gems/figaro-0.7.0/lib/figaro.rb:17:in `env'
from /Library/Ruby/Gems/2.0.0/gems/figaro-0.7.0/lib/figaro/railtie.rb:7:in `block in <class:Railtie>'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:36:in `call'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /Library/Ruby/Gems/2.0.0/gems/activesupport-4.0.3/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/application.rb:67:in `inherited'
from /Users/jamesrobinson/maeson/Chippy/config/application.rb:14:in `<module:Chippy>'
from /Users/jamesrobinson/maeson/Chippy/config/application.rb:13:in `<top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `require'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:74:in `block in <top (required)>'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `tap'
from /Library/Ruby/Gems/2.0.0/gems/railties-4.0.3/lib/rails/commands.rb:71:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
application.rb中
require File.expand_path('../boot', __FILE__)
require 'rails/all'
require "active_merchant"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module Chippy
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
Application.yml
# Add application configuration variables here, as shown below.
#
# PUSHER_APP_ID: "2954"
# PUSHER_KEY: 7381a978f7dd7f9a1117
# PUSHER_SECRET: abdc3b896a0ffb85d373
# STRIPE_API_KEY: EdAvEPVEC3LuaTg5Q3z6WbDVqZlcBQ8Z
# STRIPE_PUBLIC_KEY: pk_BRgD57O8fHja9HxduJUszhef6jCyS
development:
STRIPE_SECRET_KEY: "sk_test_redactedredactedredractedWdLb"
STRIPE_PUBLISHABLE_KEY: "pk_test_redactedredactedredractedAJb"
GMAIL_USERNAME: "user@gmail.com"
GMAIL_PASSWORD: "password"
非常感谢
答案 0 :(得分:1)
根据您的config/application.yml
文件,您已使用tabs
进行缩进。
YAML
不允许 TAB字符(\ t)进行缩进。使用 2个空格缩进替换config/application.yml
中的所有标签。
例如:
development:
STRIPE_SECRET_KEY: "sk_test_redactedredactedredractedWdLb"
STRIPE_PUBLISHABLE_KEY: "pk_test_redactedredactedredractedAJb"
GMAIL_USERNAME: "user@gmail.com"
GMAIL_PASSWORD: "password"
答案 1 :(得分:0)
我的application.yml文件的第10行出现语法错误。将编辑器中的缩进从制表符更改为空格可以解决问题。