LoginSignup
8
8

More than 5 years have passed since last update.

Windows で vagrant up 中にエラーが出たら (`gsub!': invalid byte sequence in Windows-31J)

Last updated at Posted at 2015-07-23

Windows で virtualbox の仮想サーバーをつくるために vargant を使ってます

いろいろいじっていたら急に
vagrant up
した時に以下のようなエラーが発生するようになってしまいました

==> default: Running cleanup tasks for 'shell' provisioner...
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/provisioners/shell/provisioner.rb:179:in `gsub!': invalid byte sequence in Windows-31J (
ArgumentError)
       from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/provisioners/shell/provisioner.rb:179:in `with_script_file'
       from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/provisioners/shell/provisioner.rb:52:in `provision_ssh'
       from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/provisioners/shell/provisioner.rb:24:in `provision'
       from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/provision.rb:133:in `run_provisioner'
## ~ 以下省略 ~

いろいろ調べてみると、 config.vm.provision に設定したプロビジョニング用のシェルに全角文字のコメントを追加したのが原因のようでした

コメントはそのまま残したかったので Vagrantfile に以下の設定を追加することでエラーを解消できました

Encoding.default_external = 'UTF-8'

※参考 (助かりました!)
http://dqn.sakusakutto.jp/2014/02/vagrant_up_gsub_invalid_byte_se.html

8
8
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
8
8