概要
最近導wordpressのローカル環境をvagrantで構築しました。一度削除して再構築しようと思いよくわからず物理的にローカルのwordpress環境のディレクトリを削除したらvagrant box addしたらエラーが出たので色々と調べて試してみました。
vagrant box addで出たエラー
vagrant box add miya0001/vccw
==> box: Loading metadata for box 'miya0001/vccw'
box: URL: https://atlas.hashicorp.com/miya0001/vccw
==> box: Adding box 'miya0001/vccw' (v2.19.0) for provider: virtualbox
The box you're attempting to add already exists. Remove it before
adding it again or add it with the `--force` flag.
Name: miya0001/vccw
Provider: virtualbox
Version: 2.19.0
vagrant upで A VirtualBox machine already exists.とでる解決方法
上の記事を参考にして試してみましたがエラーは解消されませんでした。
次に参考したのはこちらのサイト
Mac で $ vagrant box add にエラーが出た時の対処法メモ
つまり
$ rm -r ~/.vagrant.d/
をしたあとに
$ vagrant box add ubuntu-14.04 trusty-server-cloudimg-amd64-vagrant-disk1.box
をすると
~/.vagrant.d/配下を全部消してしまうともう一つ構築していた他の環境が使えなくなるのかなと思い、最終的には以下のようにエラーを出していたboxだけ削除したらエラーは解消されました。
cd ~/.vagrant.d/boxes/
ls
CentOS71 miya0001-VAGRANTSLASH-vccw #こちらのboxでエラーが出ていたので、これだけ削除
rm -fr miya0001-VAGRANTSLASH-vccw/
vagrant box addのエラーは解消したがvagrant upでエラー
vagrant box addは成功しましたらが、結局vagrant upで以下のエラーが出ました。
~/.vagrant.d/を退避して試して
A VirtualBox machine with the name 'vccw.dev' already exists.
Please use another name or delete the machine with the existing
name, and try again.
~/.vagrant.d/を退避
~/.vagrant.d/を退避してvagrant box addしてvagrant upしたがまた同じエラーが出ました。
A VirtualBox machine with the name 'vccw.dev' already exists.
Please use another name or delete the machine with the existing
name, and try again.
~/VirtualBox VMsの中にvccw.devを複数発見
とりあえず最新日付のvccw.dev_1(4/1のもの)をひとつだけ残して、他を削除してvagrant upしたら最終的にvagrant up出来ました。
3 18 17:12 vccw.dev/
3 27 18:22 vccw.dev_1_1459070520871_21360/
3 27 20:52 vccw.dev_1_1459079515262_11949/
4 1 07:18 vccw.dev_1_1459462678135_49839/