Ruby on rails 无法运行rails控制台和I';我不确定是什么问题

Ruby on rails 无法运行rails控制台和I';我不确定是什么问题,ruby-on-rails,ruby,rubygems,Ruby On Rails,Ruby,Rubygems,我试图运行rails控制台,但是我收到了一堆消息,我无法确定问题的确切位置。其他Rails命令正在运行 我在GEM文件中看到过运行spring-stop或注释spring的建议,但这两种方法都不起作用 我在我的终端上得到这个: rails console /home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:4:in `block in <main>': undefined local variable or m

我试图运行
rails控制台
,但是我收到了一堆消息,我无法确定问题的确切位置。其他Rails命令正在运行

我在GEM文件中看到过运行
spring-stop
或注释spring的建议,但这两种方法都不起作用

我在我的终端上得到这个:

rails console
/home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:4:in `block in <main>': undefined local variable or method `new_task' for #<ActionDispatch::Routing::Mapper:0x0000557103736ee0> (NameError)
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `instance_exec'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:429:in `eval_block'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/actionpack-6.0.2.2/lib/action_dispatch/routing/route_set.rb:411:in `draw'
    from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/routes.rb:1:in `<main>'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:55:in `load'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `block in load_paths'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `each'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:41:in `load_paths'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:20:in `reload!'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:30:in `block in updater'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/file_update_checker.rb:83:in `execute'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/routes_reloader.rb:10:in `execute'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application/finisher.rb:184:in `block in <module:Finisher>'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:32:in `run'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.2.2/lib/rails/application.rb:363:in `initialize!'
    from /home/lutzcc1/code/lutzcc1/rails-task-manager/config/environment.rb:5:in `<main>'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:23:in `require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `block in require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:106:in `preload'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:157:in `serve'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:145:in `block in run'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `loop'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application.rb:139:in `run'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /home/lutzcc1/.rbenv/versions/2.6.6/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
问题是:

as: new_task
你可能是说

as: :new_task

这就是rails抱怨未定义的方法或变量的原因。
new\u task

似乎是您弄乱了路由文件。你能给我们看一下
config/routes.rb
文件吗?当然可以。刚刚更新了postWelcome to SO!“”及其链接页和“”都是很好的阅读工具。我们不在乎你是新来的还是没有经验的,我们只希望你能提出好的问题。
as: :new_task