运行 vagrant 时方法丢失错误

Posted

技术标签:

【中文标题】运行 vagrant 时方法丢失错误【英文标题】:Method missing error when running vagrant 【发布时间】:2020-12-12 23:24:31 【问题描述】:

我的开发环境依赖于 vagrant 和 virtual box。直到几天前,一切都正常工作。从那以后,每次我尝试运行 vagrant up 时,都会收到此错误消息。

我真的不知道该怎么办。有什么建议吗?

C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:90:in `method_missing': undefined method `run_remote=' for #<VagrantPlugins::Triggers::DSL:0x00000000049cb5b8> (NoMethodError)
        from D:/Projects/D3TzH/D3TzH-environment/Vagrantfile:41:in `block (2 levels) in <top (required)>'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:11:in `instance_eval'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/dsl.rb:11:in `fire!'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:52:in `block in fire_triggers'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:51:in `each'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:51:in `fire_triggers'
        from C:/Users/D3TzH/.vagrant.d/gems/2.4.4/gems/vagrant-triggers-0.5.3/lib/vagrant-triggers/action/trigger.rb:18:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builtin/before_trigger.rb:23:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/warden.rb:50:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/builder.rb:116:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in `block in run'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/util/busy.rb:19:in `busy'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/action/runner.rb:102:in `run'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:238:in `action_raw'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:209:in `block in action'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/environment.rb:615:in `lock'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:195:in `call'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/machine.rb:195:in `action'
        from C:/HashiCorp/Vagrant/embedded/gems/2.2.4/gems/vagrant-2.2.4/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'

【问题讨论】:

Vagrant 触发器插件提供了包含在很久以前发布的 2.1.0 核心 Vagrant 中的功能。该插件后来变得不兼容。尝试卸载该插件,看看是否能解决您的问题。 @MattSchuchard 如果您将此作为实际帖子,我可以接受它作为解决方案。您的评论解决了我的问题 【参考方案1】:

随着 Vagrant 2.1.0 的发布,vagrant-triggers 插件的功能被整合到核心 Vagrant 产品中。如Vagrant 2.1.0 announcement 中所述,该插件现在与 Vagrant >= 2.1.0 的版本不兼容:

这项工作受到@emyl 出色的社区插件 vagrant-triggers 的极大启发。是对插件的完全重写,所以两者不兼容。

鉴于这种情况,该错误很可能通过卸载第三方vagrant-triggers 插件来修复。

【讨论】:

以上是关于运行 vagrant 时方法丢失错误的主要内容,如果未能解决你的问题,请参考以下文章

vagrant ssh 的问题:终止,1 个错误的配置选项

vagrant命令没有运行magento设置

vagrant up 运行时 Ping IP 地址超时

Vagrant 同步文件夹上的 Composer 错误

VirtualBox,Vagrant和Laravel Homestead“vagrant up”错误

vagrant up命令抛出ssl错误