gpt4 book ai didi

ruby-on-rails - Rails 服务器上的 NoMethodError

转载 作者:数据小太阳 更新时间:2023-10-29 07:59:54 26 4
gpt4 key购买 nike

我正在尝试启动 Rails 服务器,但出现以下错误并且服务器关闭。我怀疑我缺少依赖项,但我是 Ruby 菜鸟,所以我很可能是错的。

 => Booting WEBrick
=> Rails 4.1.0 application starting in development on `http://0.0.0.0:3000`
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Exiting
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/server.rb:133:in
`log_to_stdout': undefined method `formatter' for nil:NilClass
(NoMethodError) from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/server.rb:67:in
`start' from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in
`block in server' from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in
`tap' from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in
`server' from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in
`run_command!' from
/Users/darrin/inventory/vendor/ruby/2.1.0/gems/railties-4.1.0/lib/rails/commands.rb:17:in
`<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in
`<main>'

更新:我的 Gemfile 中没有“execjs”或“therubyracer”gem。这是我所拥有的:

source 'https://rubygems.org'
ruby '2.1.1'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '4.1.0'

group :development do
gem 'sqlite3', '1.3.8'
end

gem 'sass', '3.3.6'
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
gem 'haml'
gem 'railties'
gem 'faraday', '~> 0.9.0'
gem 'annyang_rails'
gem 'savon', '~> 2.3.0'
gem 'httparty'
gem 'speechcloud', '~> 0.1.1'
gem 'json', '~> 1.8.1'
gem 'sinatra', '~> 1.4.5'
gem 'rack', '~> 1.4'
gem 'rack-protection', '~> 1.4'
gem 'permutation', '~> 0.1.8'
gem 'tilt', '~> 1.3'
gem 'bacon', '~> 1.2.0'
gem 'activesupport', '~> 4.1.0'

group :doc do
gem 'sdoc', '0.3.20', require: false
end

group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
end

就启动 Rails 服务器而言,我只是键入 Rails Server。没有其他的。

顺便说一句,如果您看不出来,我对 RoR 还很陌生。

最佳答案

log_to_stdout': nil:NilClass 的未定义方法'formatter'
(NoMethodError)

那是你的错误,正如评论中所指出的,它看起来像是 logger

的问题

我只能推测问题可能与依赖项有关(请发布您的Gemfile),或与您的环境有关(没有正确安装 ruby​​ 或其他)

你能为我们发布你的 Gemfile 吗?

关于ruby-on-rails - Rails 服务器上的 NoMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23577501/

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