gpt4 book ai didi

ruby-on-rails - 使用 private_pub gem 时服务器中出现错误

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

我一直在尝试使用 private_pub gem 在示例应用程序中进行实时更新,以便我可以学习它并在我正在开发的应用程序中使用它。但是当我输入

时它总是抛出以下错误
rails s


shyam@shyam-SATELLITE-C50-B:~/Ajaxtry$ rails s
=> Booting Thin
=> Rails 4.2.2 application starting in development on
http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Exiting
/home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/private_pub-1.0.3/lib/private_pub.rb:21:in `load_config': uninitialized constant YAML (NameError)
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/private_pub-1.0.3/lib/private_pub/engine.rb:8:in `block in <class:Engine>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `instance_exec'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:30:in `run'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `call'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/initializable.rb:54:in `run_initializers'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/application.rb:352:in `initialize!'
from /home/shyam/Ajaxtry/config/environment.rb:5:in `<top (required)>'
from /home/shyam/Ajaxtry/config.ru:3:in `require'
from /home/shyam/Ajaxtry/config.ru:3:in `block in <main>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `instance_eval'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:55:in `initialize'
from /home/shyam/Ajaxtry/config.ru:in `new'
from /home/shyam/Ajaxtry/config.ru:in `<main>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `eval'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:49:in `new_from_string'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/builder.rb:40:in `parse_file'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:299:in `build_app_and_options_from_config'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:208:in `app'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/server.rb:61:in `app'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/server.rb:336:in `wrapped_app'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/server.rb:139:in `log_to_stdout'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/server.rb:78:in `start'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:80:in `block in server'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:75:in `server'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.2/lib/rails/commands.rb:17:in `<top (required)>'
from /home/shyam/Ajaxtry/bin/rails:9:in `require'
from /home/shyam/Ajaxtry/bin/rails:9:in `<top (required)>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/client/rails.rb:28:in `load'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/client/rails.rb:28:in `call'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/client/command.rb:7:in `call'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/client.rb:28:in `run'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/bin/spring:49:in `<top (required)>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/binstub.rb:11:in `load'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.5.0/lib/spring/binstub.rb:11:in `<top (required)>'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/shyam/.rbenv/versions/2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/shyam/Ajaxtry/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'

瘦服务器似乎工作正常。将不胜感激任何帮助。我正在使用 ruby​​ -v 2.2.2p95 和 rails 4.2.2

更新:

我不认为它与 private_pub gem 或 Sync gem 有关(我尝试使用 Sync 只是为了确保)。它仍然显示相同的错误。因为它说 YAML 是一个未初始化的常量,所以我检查了存储 YAML 负载的函数,它看起来像下面这样:

#.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/sync-0.3.5/lib/sync.rb 
def load_config(filename, environment)
reset_config
yaml = YAML.load(ERB.new(File.read(filename)).result)[environment.to_s]
raise ArgumentError, "The #{environment} environment does not exist in #{filename}" if yaml.nil?
yaml.each{|key, value| config[key.to_sym] = value }
setup_logger

if adapter
setup_client
else
setup_dummy_client
end
end

为什么 ruby​​ 无法识别 YAML?

最佳答案

Private Pub 不适用于 Rails 4。它已 fork 到此 gem:

https://github.com/gregmolnar/chatter

查看此主题并发表评论:https://github.com/ryanb/private_pub/issues/83#issuecomment-23869164

关于ruby-on-rails - 使用 private_pub gem 时服务器中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34108564/

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