Не удается установить плагин vagrant: зависание гемов не может быть установлено

6728
msanford

Я пытаюсь установить плагин vagrant-vbguest в Windows 7 из Cygwin 64.

$ vagrant plugin install vagrant-vbguest Installing the 'vagrant-vbguest' 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:  An error occurred while installing json (1.8.1), and Bundler cannot continue. Make sure that `gem install json -v '1.8.1'` succeeds before bundling. 

Выполнение предложенного шага приводит к:

$ gem install json -v '1.8.1' Building native extensions. This could take a while... Successfully installed json-1.8.1 1 gem installed Installing ri documentation for json-1.8.1... Installing RDoc documentation for json-1.8.1... 

Выполнение первой команды затем завершается неудачно таким же образом.

5

3 ответа на вопрос

6
evanjd

This can occur if you install Vagrant in a folder containing spaces. For example, C:\Program Files\HashiCorp\Vagrant instead of the default C:\HashiCorp\Vagrant.

Two solutions are available to you:

  • Reinstall Vagrant to a folder without any spaces (eg. the default installation folder)
  • Modify your PATH environmental variable to use the legacy folder shortnames in place of folders with spaces. For example, Program Files becomes PROGRA~1 and Program Files (x86) becomes PROGRA~2 (in most cases, you should verify this yourself by typing these paths in and verifying the two shortnames map to the same folders as I specified).

To modify your environmental variables, go to Control Panel, System, Advanced System Settings, click on the Advanced Tab, and then click the Environmental Variables button at the bottom of the window. In the System variables frame, select the Path variable and then click Edit. From there, change the path of your Vagrant bin to use shortnames in place of folders with spaces. In my case, since I installed Vagrant in Program Files (x86) directory, my Path variable looks something like this:

[semi-colon delimited list of other paths];C:\PROGRA~2\HashiCorp\Vagrant\bin 

After you've done this, open a new command prompt and try your plugin installation again.

2
An Do Tran

Вы можете установить плагин локально.

  • Загрузите гем плагина с https://rubygems.org/ и сохраните его где-нибудь ( C:\somewhere)
  • В расположении плагина выполните следующую команду:

    C:\somewhere>vagrant plugin install vagrant-vbguest-0.10.0.gem 
Это самое простое решение для Windows. Ежу понятно :-) Vacilando 8 лет назад 0
Почему это не задокументировано? Я потратил два дня на это. Я делаю пиар прямо сейчас! renoirb 8 лет назад 0
1
m1keil

Vagrant comes with its own embedded ruby, and doesn't use system ruby. So you need to install/reinstall gem by using the embedded gem utility.

For example on my OS X:

~ -> /Applications/Vagrant/embedded/bin/gem list *** LOCAL GEMS *** bigdecimal (1.2.0) io-console (0.4.2) json (1.7.7) minitest (4.3.2) psych (2.0.0) rake (0.9.6) rdoc (4.0.0) test-unit (2.0.0.0) 

Locate Vagrant's gem and and try running install again.