vagrant 2.1.5にアップデートしたら動かなくなったのを修正した
Vagrantをアップデートしたら動かなくなった。
VirtualBoxでkusanagiのRuby on Railsの勉強でもしようと思って
不用意にもvagrantを2.1.1から2.1.5にアップデートして、いざvagrant up
を実行したら以下のエラーが出た。
$ 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 (= 2.1.1)'
あまり何も考えずにvagrant plugin expunge --reinstall
何故真ん中のコマンドを実行したのかわからないが、
vagrant plugin expunge --reinstall This command permanently deletes all currently installed user plugins. It should only be used when a repair command is unable to properly fix the system. Continue? [N]: y All user installed plugins have been removed from this Vagrant environment! Vagrant will now attempt to reinstall user plugins that were removed. Installing the 'sahara' plugin. This can take a few minutes... Fetching: open4-1.3.4.gem (100%) Fetching: Platform-0.4.1.gem (100%) Fetching: popen4-0.1.2.gem (100%) Fetching: sahara-0.0.17.gem (100%) Fetching: micromachine-2.0.0.gem (100%) Fetching: vagrant-vbguest-0.16.0.gem (100%) Bundler, the underlying system Vagrant uses to install plugins, reported an error. The error is shown below. These errors are usually caused by misconfigured plugin installations or transient network issues. The error from Bundler is: Unable to resolve dependency: user requested 'vagrant (= 2.1.1)'
なんだこれは。となって色々ググっても みんなこのコマンドで直っていて、ここでエラー出ている人が見つからなかった。
その後も3つあるコマンドを色々繰り返しても同じようなエラーが出る。
しまいにはさっきと違うエラーが出たので結構やばいと思った。
$ vagrant plugin expunge --reinstall This command permanently deletes all currently installed user plugins. It should only be used when a repair command is unable to properly fix the system. Continue? [N]: Vagrant expunge has been declined. Skipping removal of plugins. Vagrant will now attempt to reinstall user plugins that were removed. Installing the 'vagrant' plugin. This can take a few minutes... /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/plugin/manager.rb:156:in `install_plugin': undefined method `name' for nil:NilClass (NoMethodError) from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/action/install_gem.rb:30:in `call' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/action/warden.rb:34:in `call' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/action/builder.rb:116:in `call' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `block in run' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/util/busy.rb:19:in `busy' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/action/runner.rb:66:in `run' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/command/base.rb:14:in `action' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/command/expunge.rb:77:in `block in execute' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/command/expunge.rb:69:in `each' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/command/expunge.rb:69:in `execute' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/plugins/commands/plugin/command/root.rb:66:in `execute' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/cli.rb:54:in `execute' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/lib/vagrant/environment.rb:291:in `cli' from /opt/vagrant/embedded/gems/2.1.5/gems/vagrant-2.1.5/bin/vagrant:164:in `<main>'
意を決して.vagrant.d
ディレクトリを探る。
*ここからは、たまたまうまくいっただけだと思うので、万が一があっても自己責任でお願いします。。。 自分もそこまで理解してやっているわけではございませんので、、
プラグイン周りのエラーぽかったので、plugins.json
を見てみる。
Unable to resolve dependency: user requested 'vagrant (= 2.1.1)'
最初からこのエラーがずっと出ていたので、気になっていた。
vagrant2.1.1の設定のままになっているファイルがあるはずと。
プラグインのreinstallやらを最初からコマンドで紹介されていたので、 plugins.jsonを見つけてピンときた。
{"version":"1","installed":{"vagrant":{"ruby_version":"2.4.4","vagrant_version":"2.1.1","gem_version":"","require":"","sources":["https://rubygems.org/","https://gems.hashicorp.com/"],"installed_gem_version":"2.1.1"}}}
ここに2.1.1の記述があるので、2.1.5に変更してやってみた、
{"version":"1","installed":{"vagrant":{"ruby_version":"2.4.4","vagrant_version":"2.1.5","gem_version":"","require":"","sources":["https://rubygems.org/","https://gems.hashicorp.com/"],"installed_gem_version":"2.1.5"}}}
そしてvagrant up
したら
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Importing base box 'yuya_tajima/kusanagi'... ==> default: Matching MAC address for NAT networking...
うごいた!!
ディレクトリ内を見ても他に2.1.1の設定がなさそうだったので、解決したぽい。
エラー時に意味も理解しないで不用意にコマンドうちまくるとなかなか苦労します。。