运行"捆绑执行 rspec"时出现问题



我正在做一个教育项目,我必须使用bundle exec rspec。在我的控制台中,我有这个错误:

C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:50:in `match?': invalid byte sequence in UTF-8 (ArgumentError)
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:50:in `chop_basename'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:374:in `plus'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:354:in `+'
from C:/Ruby30-x64/lib/ruby/3.0.0/pathname.rb:420:in `join'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/settings.rb:444:in `global_config_file'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/settings.rb:93:in `initialize'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:330:in `new'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler.rb:330:in `settings'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/feature_flag.rb:21:in `block in settings_method'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/cli.rb:104:in `<class:CLI>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/cli.rb:6:in `<module:Bundler>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/cli.rb:5:in `<top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/exe/bundle:39:in `require_relative'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/exe/bundle:39:in `block in <top (required)>'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/bundler-2.2.28/exe/bundle:37:in `<top (required)>'
from C:/Ruby30-x64/bin/bundle:23:in `load'
from C:/Ruby30-x64/bin/bundle:23:in `<main>'

我在使用ruby 3.1.x时也遇到了同样的问题。正如Tom Lor所提到的,我卸载了它并安装了2.7。在重新安装时,它会询问您是否希望外部编码器默认为UTF-8(它没有在3.1.x中询问)。

选中那个方框,它就会起作用。

相关内容

  • 没有找到相关文章

最新更新