vagrant,在启动虚拟机的时候报错io.rb:32:in `encode': incomplete "\xC8" on GBK (Encoding::InvalidByteSequenceError)

描述

  这几天在windows环境上,部署了vagrant,在启动虚拟机的时候报错:

解决过程

  找了好久,都没有说明白,后来在国外的github上看到了解决的方案。

参考地址:https://github.com/hashicorp/vagrant/issues/9368

参考内容:

My Solution

With the help of a non vagrant-related StackOverflow solution, I solved the issue by changing the line 32 in "Vagrant\embedded\gems\gems\vagrant-2.0.1\lib\vagrant\util" as:

data << io.readpartial(READ_CHUNK_SIZE).encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')

即修改源代码,说改就改:

  #data << io.readpartial(READ_CHUNK_SIZE).encode("UTF-8", Encoding.default_external)
  data << io.readpartial(READ_CHUNK_SIZE).encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')

 

 

  修改之后,重新执行命令vagrant up

 

posted @ 2020-12-18 12:56  乖怪丶  阅读(458)  评论(1编辑  收藏  举报
……