我正在使用 Vagrant 1.6.5 并尝试部署到 Amazon AWS。我可以成功部署到 DigitalOcean,但使用 AWS 时出现错误:
The provider 'aws' could not be found, but was requested to
back the machine 'default'. Please use a provider that
exists.
我已经验证了 aws 插件已经安装,
$ vagrant plugin list
vagrant-aws (0.5.0)
vagrant-digitalocean (0.7.0)
vagrant-login (1.0.1, system)
vagrant-share (1.1.1, system)
当我在 Google 上搜索这个错误时,我得到的唯一建议是添加
vagrant.require_plugin 'vagrant-aws'
到 Vagrantfile 的开头。然而,这并没有修复错误,而且 vagrant 表示它已被弃用。
我真的被这个问题难住了,不知道下一步该怎么做。下面是完整的错误消息,希望有用。
谢谢你,杰森
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::Errors::ProviderNotFound: The provider 'aws' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.>
ERROR vagrant: The provider 'aws' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.
ERROR vagrant: /opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/vagrantfile.rb:119:in `machine_config'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/vagrantfile.rb:45:in `machine'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:537:in `machine'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/v2/command.rb:168:in `block in with_target_vms'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/v2/command.rb:192:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/v2/command.rb:192:in `block in with_target_vms'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/v2/command.rb:174:in `each'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/plugin/v2/command.rb:174:in `with_target_vms'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/up/command.rb:67:in `block in execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:268:in `block (2 levels) in batch'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:266:in `tap'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:266:in `block in batch'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:265:in `synchronize'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:265:in `batch'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/commands/up/command.rb:58:in `execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/cli.rb:42:in `execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:292:in `cli'
/opt/vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/bin/vagrant:174:in `<main>'
INFO interface: error: The provider 'aws' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.
The provider 'aws' could not be found, but was requested to
back the machine 'default'. Please use a provider that exists.
INFO interface: Machine: error-exit ["Vagrant::Errors::ProviderNotFound", "The provider 'aws' could not be found, but was requested to\nback the machine 'default'. Please use a provider that exists."]
答案1
如果有人搜索这个,下面是解决方案。我卸载了 vagrant-aws 插件,然后重新安装:
vagrant plugin uninstall vagrant-aws
vagrant plugin install vagrant-aws
这解决了问题。