ruby 未找到页面

bvk5enib  于 2023-03-17  发布在  Ruby
关注(0)|答案(1)|浏览(139)

我正在构建一个Ruby应用程序,当我尝试在VS代码终端中使用命令rubocop运行Linters时,我得到了这个错误:

Command 'robocop' not found, did you mean:
  command 'rubocop' from deb rubocop (0.89.1+dfsg-3)
Try: sudo apt install <deb name>

我用gem install rubocop命令安装了rubocop,所以我不认为这是安装的问题。当我运行代码sudo apt install rubocop,然后在终端运行rubocop命令时,我得到以下错误:

(/home/tobuya/Projects/School_Library/.rubocop.yml): found character that cannot start any token while scanning for the next token at line 1 column 1
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:456:in `parse'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:456:in `parse_stream'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/3.0.0/psych.rb:390:in `parse'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/yaml_duplication_checker.rb:12:in `check'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_loader.rb:215:in `check_duplication'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_loader.rb:63:in `load_yaml_configuration'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_loader.rb:43:in `load_file'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_loader.rb:104:in `configuration_from_file'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_store.rb:68:in `for_dir'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/config_store.rb:47:in `for_pwd'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:145:in `parallel_by_default!'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:49:in `block in run'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:77:in `profile_if_needed'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/lib/rubocop/cli.rb:43:in `run'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/exe/rubocop:19:in `block in <top (required)>'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
/home/tobuya/.rbenv/versions/3.0.1/lib/ruby/gems/3.0.0/gems/rubocop-1.48.1/exe/rubocop:19:in `<top (required)>'
/home/tobuya/.rbenv/versions/3.0.1/bin/rubocop:23:in `load'
/home/tobuya/.rbenv/versions/3.0.1/bin/rubocop:23:in `<main>'

我是Ruby的新手,你可以从我正在尝试构建的项目中看到,我真的很感激任何帮助和建议。我已经为此奋斗了3个多小时,我真的需要帮助。谢谢你们,我期待着有人帮助我
gem install rubocop

mpbci0fu

mpbci0fu1#

我按照安装文档操作,成功安装并使用了rubocop。根据文档,这是您安装它的方式:

gem install rubocop-rails

要在终端上使用它:

rubocop --require rubocop-rails

下面是official documentation,它告诉您如何使用rubocop

相关问题