Rails Webpacker 挂起的命令
Rails Commands Hanging with Webpacker
我正在尝试在 Windows 10 机器上创建一个新的 Rails 6 应用程序。但是,当我尝试 运行 任何 rails
或 rake
命令时,它 hangs/freezes。我在创建数据库时发现它与 Webpacker
相关联。
C:\Sites\myapp> bundle exec rake db:migrate --trace
当我终止作业时,显示如下:
rails aborted!
Interrupt:
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in ``'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in `block in <class:Engine>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `instance_exec'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `run'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:61:in `block in run_initializers'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `call'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:60:in `run_initializers'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:362:in `initialize!'
C:/Sites/highbar/config/environment.rb:5:in `<top (required)>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:338:in `require_environment!'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:514:in `block in run_tasks_blocks'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
当我在 gemfile 中注释掉 Webpacker 时,它起作用了,rails s
也是如此。一旦我取消注释 Webpacker,命令 freeze/hang 再次。
除了 bundle exec rails webpacker:install
之外,我还需要做些什么吗?
我的 NodeJS 版本已过时。当我更新 NodeJS 时,我还需要更新 Yarn。这样做之后,我可以 运行 Rails 6 使用 Webpacker。
我正在尝试在 Windows 10 机器上创建一个新的 Rails 6 应用程序。但是,当我尝试 运行 任何 rails
或 rake
命令时,它 hangs/freezes。我在创建数据库时发现它与 Webpacker
相关联。
C:\Sites\myapp> bundle exec rake db:migrate --trace
当我终止作业时,显示如下:
rails aborted!
Interrupt:
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in ``'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in `block in <class:Engine>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `instance_exec'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `run'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:61:in `block in run_initializers'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `call'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:60:in `run_initializers'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:362:in `initialize!'
C:/Sites/highbar/config/environment.rb:5:in `<top (required)>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:338:in `require_environment!'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:514:in `block in run_tasks_blocks'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
当我在 gemfile 中注释掉 Webpacker 时,它起作用了,rails s
也是如此。一旦我取消注释 Webpacker,命令 freeze/hang 再次。
除了 bundle exec rails webpacker:install
之外,我还需要做些什么吗?
我的 NodeJS 版本已过时。当我更新 NodeJS 时,我还需要更新 Yarn。这样做之后,我可以 运行 Rails 6 使用 Webpacker。