LoginSignup
3
4

More than 5 years have passed since last update.

Vagrantの再インストールでIgnoringエラーが発生する

Last updated at Posted at 2017-08-08

公式ページDownload VagrantからダウンロードしてdmgからインストールしていたVagrantを
brew caskで入れ直そうとした時に発生したエラーと解決策をメモ代わりに残しておきます。

環境

MacOS 10.12.6 (Sierra)

Vagrantをアンインストール

まずは公式サイトに記載されている方法でアンインストール。
Uninstalling Vagrant

rm -rf /Applications/Vagrant
rm -f /usr/local/bin/vagrant
sudo pkgutil --forget com.vagrant.vagrant

コマンド自体は普通に終了。

caskでVagrantをインストール

brew cask install vagrant

こちらも普通に終了。

Vagrantを起動

vagrant initしてみる



vagrant init
Ignoring ffi-1.9.17 because its extensions are not built.  Try: gem pristine ffi --version 1.9.17
Ignoring nokogiri-1.6.7.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
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

Error message given during initialization: Unable to resolve dependency: user requested 'sahara (> 0)'

エラーが発生し正常に実行できない。
plug inなんたらとエラーが表示されている
エラー内でコマンドが指示されているので試してみる。

vagrant plugin expunge --reinstall
Ignoring ffi-1.9.17 because its extensions are not built.  Try: gem pristine ffi --version 1.9.17
Ignoring nokogiri-1.6.7.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2

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...
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:

conflicting dependencies childprocess (= 0.5.9) and childprocess (= 0.6.3)
  Activated childprocess-0.6.3
  which does not match conflicting dependency (= 0.5.9)

  Conflicting dependency chains:
    childprocess (= 0.6.3), 0.6.3 activated

  versus:
    childprocess (= 0.5.9)

  Gems matching childprocess (= 0.5.9):
    childprocess-0.5.9

こちらも正常に終了しない。

解決策

調べてみると以下の様な投稿を発見
Vagrant up can't find Berkshelf #256

インストール方法を変更してインストールしたため、残っていたファイルが影響している可能性があるので
以下を実行。

rm -r ~/.vagrant.d

もう一度initを試してみる。

vagrant init
Ignoring ffi-1.9.17 because its extensions are not built.  Try: gem pristine ffi --version 1.9.17
Ignoring nokogiri-1.6.7.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
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:
-- 以下略 --

同じエラーが発生する。

念のためcaskでアンインストールし、インストールし直してみる

brew cask uninstall vagrant
brew cask tap vagrant

initを再度試す。

vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

正常にinitが終了。

upも試してみる。

vagrant init bento/centos-7.3
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
XXXXXX:test XXXXXXXXXX$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/centos-7.3' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
-- 以下略 --

こちらも正常に起動し使えるようになった。

まとめ

dmgからインストールしたVagrantを削除してからcaskでVagrantをインストールする場合は、
公式の手順

rm -rf /Applications/Vagrant
rm -f /usr/local/bin/vagrant
sudo pkgutil --forget com.vagrant.vagrant

の他に

rm -r ~/.vagrant.d

を実行してから
caskでインストールするのがよろしいみたいです。

#もしインストールしていれば一旦削除。
brew cask uninstall vagrant
brew cask tap vagrant

滅多にそのような機会は無いかと思いますが記録しておきます。

3
4
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
3
4