неверная последовательность байтов в GBK. Bundler не может продолжить - PullRequest
0 голосов
/ 06 ноября 2018

В моем проекте jekyll есть файл с именем на китайском языке. Когда я запускаю bundle exec jekyll serve --drafts в терминале, он сообщает об ошибке:

C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:511:in `rescue in eval_gemspec':  (Bundler::Dsl::DSLError)
[!] There was an error parsing `Gemfile`:
[!] There was an error while loading `jekyll-theme-so-simple.gemspec`: invalid byte sequence in GBK. Bundler cannot continue.

 #  from E:/Github/shangchihh.github.io/jekyll-theme-so-simple.gemspec:14
 #  -------------------------------------------
 #    spec.add_development_dependency "rake", "~> 10.0"
 >  end
 #  # coding: utf-8
 #  -------------------------------------------
. Bundler cannot continue.

 #  from E:/Github/shangchihh.github.io/Gemfile:2
 #  -------------------------------------------
 #  source "https://rubygems.org"
 >  gemspec #  source "https://rubygems.org"
 #  -------------------------------------------
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:502:in `eval_gemspec'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:440:in `block in load_gemspec_uncached'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/shared_helpers.rb:65:in `chdir'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/shared_helpers.rb:65:in `block in chdir'
        from C:/Ruby25-x64/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/shared_helpers.rb:64:in `chdir'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:439:in `load_gemspec_uncached'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:425:in `load_gemspec'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:66:in `block in gemspec'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:66:in `map'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:66:in `gemspec'
        from E:/Github/shangchihh.github.io/Gemfile:2:in `eval_gemfile'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:47:in `instance_eval'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:47:in `eval_gemfile'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/dsl.rb:12:in `evaluate'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/definition.rb:35:in `build'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:135:in `definition'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler.rb:101:in `setup'
        from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bundler-1.16.3/lib/bundler/setup.rb:20:in `<top (required)>'
        from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from C:/Ruby25-x64/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'

и 14-я строка файла gemspec:

spec.files                   = `git ls-files -z`.split("\x0").select do |f|

Эта ошибка вызвана тем, что Ruby не может обработать кодировку GBK? Как я могу решить эту проблему?

...