CLOVER🍀

That was when it all began.

Vagrantのプラグインのインストールが失敗する場合には、VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1を指定する

VagrantのProviderにlibvirtを使っているのですが、Vagrantをバージョンアップしたらvagrant-libvirtもアップデートする必要が
あったりします。

$ vagrant up
Vagrant failed to initialize at a very early stage:

The plugins failed to initialize correctly. This may be due to manual
modifications made within the Vagrant home directory. Vagrant can
attempt to automatically correct this issue by running:

  vagrant plugin repair

If Vagrant was recently updated, this error may be due to incompatible
versions of dependencies. To fix this problem please remove and re-install
all plugins. Vagrant can attempt to do this automatically by running:

  vagrant plugin expunge --reinstall

Or you may want to try updating the installed plugins to their latest
versions:

  vagrant plugin update

Error message given during initialization: Unable to resolve dependency: user requested 'vagrant-libvirt (= 0.12.2)'

で、再インストールしようとした時にこんな感じで依存関係でハマった時にどうするかというメモです。

$ vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

conflicting dependencies csv (= 3.2.8) and csv (= 3.3.4)
  Activated csv-3.3.4
  which does not match conflicting dependency (= 3.2.8)

  Conflicting dependency chains:
    csv (= 3.3.4), 3.3.4 activated

  versus:
    csv (= 3.2.8)

  Gems matching csv (= 3.2.8):
    csv-3.2.8

VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1を指定すればよさそうです。

実行例。

$ VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT=1 vagrant plugin install vagrant-libvirt

これでプラグインが再インストールできました。

Installed the plugin 'vagrant-libvirt (0.12.2)'!

今回のVagrantのバージョンはこちらです。

$ vagrant version
Installed Version: 2.4.4
Latest Version: 2.4.4

You're running an up-to-date version of Vagrant!