3

I'm running the latest RubyMine, 2020.1.1 (Build #RM-201.7223.94), Ruby 2.7 and Rails 6.0.2.2. When I try to start a Rails console, I get this error:

C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails" console -- --simple-prompt --legacy
Loading development environment (Rails 6.0.3.1)
Switch to inspect mode.
C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/reline/line_editor.rb:211:in `div': divided by 0 (ZeroDivisionError)
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/reline/line_editor.rb:211:in `calculate_height_by_width'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/reline/line_editor.rb:352:in `rerender'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/reline.rb:225:in `inner_readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/reline.rb:187:in `readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/forwardable.rb:235:in `readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/forwardable.rb:235:in `readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/input-method.rb:161:in `gets'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:518:in `block (2 levels) in eval_input'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:695:in `signal_status'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:517:in `block in eval_input'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `lex'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:138:in `block (2 levels) in each_top_level_statement'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:536:in `eval_input'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:471:in `block in run'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:470:in `catch'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:470:in `run'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/irb.rb:399:in `start'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/commands/console/console_command.rb:70:in `start'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/commands/console/console_command.rb:19:in `start'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/commands/console/console_command.rb:102:in `perform'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/command/base.rb:69:in `perform'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/command.rb:46:in `invoke'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/railties-6.0.3.1/lib/rails/commands.rb:18:in `<top (required)>'
    from C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails:4:in `require'
    from C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails:4:in `<main>'
▽
Process finished with exit code 1

When I try to run a plain IRB one:

C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Program Files/JetBrains/RubyMine 2020.1.1/plugins/ruby/rb/testing/runner/irb.rb" --simple-prompt --legacy
Switch to inspect mode.
C:/Users/pupeno/scoop/persist/ruby/gems/gems/reline-0.1.4/lib/reline/line_editor.rb:211:in `div': divided by 0 (ZeroDivisionError)
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/reline-0.1.4/lib/reline/line_editor.rb:211:in `calculate_height_by_width'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/reline-0.1.4/lib/reline/line_editor.rb:352:in `rerender'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/reline-0.1.4/lib/reline.rb:225:in `inner_readline'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/reline-0.1.4/lib/reline.rb:187:in `readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/forwardable.rb:235:in `readline'
    from C:/Users/pupeno/scoop/apps/ruby/2.7.1-1/lib/ruby/2.7.0/forwardable.rb:235:in `readline'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/input-method.rb:161:in `gets'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:518:in `block (2 levels) in eval_input'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:694:in `signal_status'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:517:in `block in eval_input'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:166:in `lex'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:138:in `block (2 levels) in each_top_level_statement'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:135:in `loop'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:134:in `catch'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb/ruby-lex.rb:134:in `each_top_level_statement'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:536:in `eval_input'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:471:in `block in run'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:470:in `catch'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:470:in `run'
    from C:/Users/pupeno/scoop/persist/ruby/gems/gems/irb-1.2.3/lib/irb.rb:399:in `start'
    from C:/Program Files/JetBrains/RubyMine 2020.1.1/plugins/ruby/rb/testing/runner/irb.rb:3:in `<main>'
▽
Process finished with exit code 1

Running either of them from a terminal inside RubyMine (which runs PowerShell) works.

Any ideas what's going wrong here?

If I try to run the same command RubyMine does when running the Rails console, it just works:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\pupeno\Documents\Flexpoint Tech\projectx-be> C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails" console -- --simple-prompt --legacy
Loading development environment (Rails 6.0.3.1)
>>

Same with a standalone PowerShell console:

PS C:\Users\pupeno\Documents\Flexpoint Tech\projectx-be> C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails" console -- --simple-prompt --legacy

Loading development environment (Rails 6.0.3.1)
>>

and even cmd.exe:

Microsoft Windows [Version 10.0.18363.836]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\pupeno>cd "Documents\Flexpoint Tech\projectx-be"

C:\Users\pupeno\Documents\Flexpoint Tech\projectx-be>C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint Tech/projectx-be/bin/rails" console -- --simple-prompt --legacy
Loading development environment (Rails 6.0.3.1)
>>                                                                                                                                                                                                                                                                           
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
  • Just to be sure, did you install 2020.1 via update? There's old RubyMine version mentioned in the command line. In addition, how does it go in case you run in command line the same `C:\Users\pupeno\scoop\apps\ruby\current\bin\ruby.exe "C:/Users/pupeno/Documents/Flexpoint Tech/projectx/bin/rails" console -- --simple-prompt --legacy`? – Olivia May 05 '20 at 09:21
  • Besides the fact that you are using forward slashes as directory separators on windows? – max May 05 '20 at 14:07
  • @Olivia I did install 2020.1 through an update. – Pablo Fernandez May 06 '20 at 05:48
  • @max: I'm not _doing_ anything, it's happening automatically by Ruby. – Pablo Fernandez May 06 '20 at 05:49
  • @pupeno, through the patch update? Would it be possible to reinstall IDE to a separate folder? – Olivia May 13 '20 at 10:25
  • @Olivia: yeah, I just let it upgrade itself. – Pablo Fernandez May 14 '20 at 18:15
  • @Olivia I have now uninstalled RubyMine entirely, killing the cache and other directories, and installed the latest version. I also updated Rails to the latest version. Same error :( – Pablo Fernandez May 22 '20 at 12:08

2 Answers2

2

I'm not sure yet if this is a solution or just a workaround. When running the Rails console from RubyMine, it creates a run profile that adds these parameters to running the console: console -- --simple-prompt --legacy. Removing --legacy seems to solve the problem.

Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
  • Could you please specify whether you're using multiline input? Is there any explicit require of `reline`? – Olivia May 29 '20 at 14:00
1

I'm on 2020.2 and getting this problem in a Rails 6 project, for both the Rails console and for IRB consoles.

Removing the automatically included --single-line option from the run definitions resolved the error for me.

Mikey T.K.
  • 1,112
  • 18
  • 43
  • I have tried your solution and it works. However, I have to remove the option manually each time I start the IRB. Is there a way to save the configuration so that the `--single-line` option is no-longer automatically included? – Mc Cheng Sep 21 '20 at 16:37
  • There does not appear to be. That option is not included in the run configuration templates, which suggests that its inclusion is hard-coded somewhere. There's probably not much to do here other than open a support case with JetBrains. @McCheng – Mikey T.K. Sep 21 '20 at 16:59