LoginSignup
2
0

More than 3 years have passed since last update.

Vagrant 2.2.4で「Encoding::UndefinedConversionError」が発生する

Posted at

問題

表題の通り。
vagrant up --provision とかコマンド叩いた後で件のエラーが発生する。

環境

OS :Windows10 pro 64bit
Vagrant :2.2.4
Virtualbox :6.0.8

原因

Windows shift-JIS から UTF-8 にエンコードしようとした際にShift-JISでしか対応していない文字?が存在したとかどうとか(よく理解していない)。

対応方法

エラーがでたファイルでエンコードしている箇所をforce_encodingメソッドに書き直す。

自身の場合、下記ファイルを修正したら解決した。

C:\HashiCorp\Vagrant\embedded\gems\2.2.4\gems\vagrant-2.2.4\lib\vagrant\util\io.rb

io.rb L32
data << io.readpartial(READ_CHUNK_SIZE).encode("UTF-8", Encoding.default_external)

↓

data << io.readpartial(READ_CHUNK_SIZE).force_encoding('UTF-8')

参考

http://kinosuke.hatenablog.jp/entry/2016/03/18/104211
https://qiita.com/J_Sugar__/items/fd55d99003262ad68412

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0